Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor brn_toast #33

Merged
merged 2 commits into from
Dec 30, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 68 additions & 46 deletions example/lib/sample/components/toast/toast_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,62 +6,84 @@ class ToastExample extends StatefulWidget {
_ToastExampleState createState() => _ToastExampleState();
}

class _ToastExampleState extends State<ToastExample> with TickerProviderStateMixin {
class _ToastExampleState extends State<ToastExample>
with TickerProviderStateMixin {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: BrnAppBar(
title: 'BrnToast示例',
),
body: SingleChildScrollView(
child: Column(
children: <Widget>[
Padding(
padding: EdgeInsets.only(top: 50, bottom: 50),
child: Center(
child: RaisedButton(
onPressed: () {
BrnToast.show("普通长Toast", context, duration: BrnToast.LENGTH_LONG, gravity: 1);
},
child: Text("普通长Toast"),
),
child: Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
ElevatedButton(
onPressed: () {
BrnToast.show(
"普通长Toast",
context,
duration: BrnDuration.long,
gravity: BrnToastGravity.center,
);
},
child: Text("普通长Toast"),
),
),
Padding(
padding: EdgeInsets.only(top: 50, bottom: 50),
child: Center(
child: RaisedButton(
onPressed: () {
BrnToast.show("失败图标Toast", context,
preIcon: Image.asset(
"assets/image/icon_toast_fail.png",
width: 24,
height: 24,
),
duration: BrnToast.LENGTH_SHORT);
},
child: Text("失败图标Toast"),
),
ElevatedButton(
onPressed: () {
BrnToast.show(
"失败图标Toast",
context,
preIcon: Image.asset(
"assets/image/icon_toast_fail.png",
width: 24,
height: 24,
),
duration: BrnDuration.short,
);
},
child: Text("失败图标Toast"),
),
),
Padding(
padding: EdgeInsets.only(top: 50, bottom: 50),
child: Center(
child: RaisedButton(
onPressed: () {
BrnToast.show("成功图标Toast", context,
preIcon: Image.asset(
"assets/image/icon_toast_success.png",
width: 24,
height: 24,
),
duration: BrnToast.LENGTH_SHORT);
},
child: Text("成功图标Toast"),
),
ElevatedButton(
onPressed: () {
BrnToast.show(
"成功图标Toast",
context,
preIcon: Image.asset(
"assets/image/icon_toast_success.png",
width: 24,
height: 24,
),
duration: BrnDuration.short,
);
},
child: Text("成功图标Toast"),
),
)
],
ElevatedButton(
onPressed: () {
BrnToast.show(
"自定义位置Toast",
context,
duration: BrnDuration.short,
verticalOffset: 100,
gravity: BrnToastGravity.bottom
);
},
child: Text("自定义位置Toast"),
),
ElevatedButton(
onPressed: () {
BrnToast.show(
"自定义时长Toast",
context,
duration: Duration(seconds: 5),
);
},
child: Text("自定义时长Toast(5s)"),
),
],
),
),
),
);
Expand Down
Loading