parent
7d688b08ac
commit
1c52272ec0
@ -0,0 +1,32 @@
|
||||
import 'package:ansu_ui/toast/as_toast.dart';
|
||||
import 'package:example/codeviewer/code_segments.dart';
|
||||
import 'package:example/component/example_scaffold.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
|
||||
class ExampleToast extends StatelessWidget {
|
||||
const ExampleToast({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ExampleScaffold(
|
||||
title: 'Toast',
|
||||
text: (context) => CodeSegments.toast(context),
|
||||
children: [
|
||||
// BEGIN toast
|
||||
ListTile(
|
||||
title: 'Toast'.text.make(),
|
||||
onTap: () => ASToast.show('Toast!'),
|
||||
),
|
||||
ListTile(
|
||||
title: 'Toast'.text.make(),
|
||||
onTap: () {
|
||||
Function cancel = ASToast.loading;
|
||||
Future.delayed(Duration(seconds: 2), () => cancel());
|
||||
},
|
||||
),
|
||||
// END
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
@ -1,7 +1,30 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ASToast {
|
||||
static show(String text) {
|
||||
BotToast.showText(text: text);
|
||||
BotToast.showText(
|
||||
text: text,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
);
|
||||
}
|
||||
|
||||
static Function get loading {
|
||||
return BotToast.showCustomLoading(
|
||||
toastBuilder: (cancel) {
|
||||
return Center(
|
||||
child: Material(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
shape: StadiumBorder(),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in new issue