simple_fontellico_progress_dialog 0.1.3 simple_fontellico_progress_dialog: ^0.1.3 copied to clipboard
This package helps you to render a progress dialog with different types of loading indicator.
import 'package:flutter/material.dart';
import 'package:simple_fontellico_progress_dialog/simple_fontico_loading.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Simple Fontellico Progress Dialog Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
SimpleFontelicoProgressDialog _dialog;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Simple Fontellico Progress Dialog Demo'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ElevatedButton(
onPressed: (){
_showDialog(context, SimpleFontelicoProgressDialogType.normal, 'Normal');
},
child: Text('Normal'),
),
SizedBox(height: 10.0,),
ElevatedButton(
onPressed: (){
_showDialog(context, SimpleFontelicoProgressDialogType.threelines, 'Three Lines');
},
child: Text('Three Lines'),
),
SizedBox(height: 10.0,),
ElevatedButton(
onPressed: (){
_showDialog(context, SimpleFontelicoProgressDialogType.multilines, 'Multilines');
},
child: Text('Multilines'),
),
SizedBox(height: 10.0,),
ElevatedButton(
onPressed: (){
_showDialog(context, SimpleFontelicoProgressDialogType.refresh, 'Refresh');
},
child: Text('Refresh'),
),
SizedBox(height: 10.0,),
ElevatedButton(
onPressed: (){
_showDialog(context, SimpleFontelicoProgressDialogType.phoenix, 'Phoenix');
},
child: Text('Phoenix'),
),
SizedBox(height: 10.0,),
ElevatedButton(
onPressed: (){
_showDialog(context, SimpleFontelicoProgressDialogType.hurricane, 'Hurricane');
},
child: Text('Hurricane'),
),
SizedBox(height: 10.0,),
ElevatedButton(
onPressed: (){
_showDialog(context, SimpleFontelicoProgressDialogType.iphone, 'Iphone');
},
child: Text('Iphone'),
),
SizedBox(height: 10.0,),
ElevatedButton(
onPressed: (){
_showDialog(context, SimpleFontelicoProgressDialogType.custom, 'Custom');
},
child: Text('Custom'),
),
SizedBox(height: 10.0,),
],
),
),
// This trailing comma makes auto-formatting nicer for build methods.
);
}
void _showDialog(BuildContext context, SimpleFontelicoProgressDialogType type, String text) async{
if(_dialog == null) {
_dialog = SimpleFontelicoProgressDialog(context: context, barrierDimisable: false);
}
if(type == SimpleFontelicoProgressDialogType.custom) {
_dialog.show(message: text, type: type, width: 150.0, height: 75.0, loadingIndicator: Text('C', style: TextStyle(fontSize: 24.0),));
} else {
_dialog.show(message: text, type: type, horizontal: true, width: 150.0, height: 75.0, hideText: true);
}
await Future.delayed(Duration(seconds: 2));
_dialog.hide();
}
}