|
| 1 | +import 'package:ai_awesome_message/ai_awesome_message.dart'; |
| 2 | +import 'package:airoute/airoute.dart'; |
1 | 3 | import 'package:flutter/material.dart'; |
2 | | -import 'package:flushbar/flushbar.dart'; |
3 | 4 |
|
4 | 5 | import '../../common/helper/tip_helper.dart'; |
5 | | -import '../../common/helper/tip_type.dart'; |
| 6 | +import '../../common/helper/tip_type.dart' as tip_type; |
6 | 7 |
|
7 | 8 | /// |
8 | 9 | /// FlushBarPage |
@@ -116,14 +117,14 @@ class _FlushBarToolState extends State<FlushBarToolPage> { |
116 | 117 | IconData _tipIconData = Icons.info_outline; |
117 | 118 |
|
118 | 119 | List<bool> _tipStyleSelected = [true, false]; |
119 | | - List<FlushbarStyle> _tipStyleValues = [ |
120 | | - FlushbarStyle.GROUNDED, |
121 | | - FlushbarStyle.FLOATING |
| 120 | + List<AwesomeMessageStyle> _tipStyleValues = [ |
| 121 | + AwesomeMessageStyle.GROUNDED, |
| 122 | + AwesomeMessageStyle.FLOATING |
122 | 123 | ]; |
123 | | - FlushbarStyle _tipStyleValue = FlushbarStyle.GROUNDED; |
| 124 | + AwesomeMessageStyle _tipStyleValue = AwesomeMessageStyle.GROUNDED; |
124 | 125 |
|
125 | | - Widget _getFlushBar() { |
126 | | - return Flushbar( |
| 126 | + Widget _getAwesomeMessage() { |
| 127 | + return AwesomeMessage( |
127 | 128 | title: "${_tipTitle ?? 'title'}", |
128 | 129 | titleText: Text( |
129 | 130 | "${_tipTitle ?? '提示'}", |
@@ -151,10 +152,10 @@ class _FlushBarToolState extends State<FlushBarToolPage> { |
151 | 152 | : _tipSecondDuration), |
152 | 153 | borderRadius: _tipBorderRadius, |
153 | 154 | margin: EdgeInsets.all(_tipMargin), |
154 | | - flushbarPosition: FlushbarPosition.TOP, |
| 155 | + awesomeMessagePosition: AwesomeMessagePosition.TOP, |
155 | 156 | shouldIconPulse: _tipIconPulse, |
156 | 157 | showProgressIndicator: _tipShowProgress, |
157 | | - flushbarStyle: _tipStyleValue, |
| 158 | + awesomeMessageStyle: _tipStyleValue, |
158 | 159 | backgroundColor: _tipStyleBackgroundColor, |
159 | 160 | borderColor: _tipStyleBorderColor, |
160 | 161 | progressIndicatorBackgroundColor: _tipIndicatorColor, |
@@ -257,7 +258,7 @@ class _FlushBarToolState extends State<FlushBarToolPage> { |
257 | 258 | ), |
258 | 259 | ], |
259 | 260 | ), |
260 | | - _getFlushBar(), |
| 261 | + _getAwesomeMessage(), |
261 | 262 | ], |
262 | 263 | ), |
263 | 264 | ), |
@@ -415,9 +416,12 @@ class _FlushBarToolState extends State<FlushBarToolPage> { |
415 | 416 | ), |
416 | 417 | floatingActionButton: FloatingActionButton( |
417 | 418 | onPressed: () { |
418 | | - Widget flushBarWidget = _getFlushBar(); |
419 | | - if (flushBarWidget is Flushbar) { |
420 | | - flushBarWidget..show(context); |
| 419 | + Widget awesomeMessageWidget = _getAwesomeMessage(); |
| 420 | + if (awesomeMessageWidget is AwesomeMessage) { |
| 421 | + Airoute.push( |
| 422 | + route: AwesomeMessageRoute( |
| 423 | + theme: null, awesomeMessage: awesomeMessageWidget), |
| 424 | + ); |
421 | 425 | } |
422 | 426 | }, |
423 | 427 | child: Icon(Icons.slideshow), |
@@ -504,31 +508,31 @@ class _FlushBarStyleState extends State<FlushBarStylePage> { |
504 | 508 | context: context, |
505 | 509 | title: "Info", |
506 | 510 | message: "message", |
507 | | - tipType: TipType.INFO, |
| 511 | + tipType: tip_type.TipType.INFO, |
508 | 512 | ); |
509 | 513 | break; |
510 | 514 | case 1: |
511 | 515 | TipHelper.showTip( |
512 | 516 | context: context, |
513 | 517 | title: "Warn", |
514 | 518 | message: "message", |
515 | | - tipType: TipType.WARN, |
| 519 | + tipType: tip_type.TipType.WARN, |
516 | 520 | ); |
517 | 521 | break; |
518 | 522 | case 2: |
519 | 523 | TipHelper.showTip( |
520 | 524 | context: context, |
521 | 525 | title: "Error", |
522 | 526 | message: "message", |
523 | | - tipType: TipType.ERROR, |
| 527 | + tipType: tip_type.TipType.ERROR, |
524 | 528 | ); |
525 | 529 | break; |
526 | 530 | case 3: |
527 | 531 | TipHelper.showTip( |
528 | 532 | context: context, |
529 | 533 | title: "Done", |
530 | 534 | message: "message", |
531 | | - tipType: TipType.COMPLETE, |
| 535 | + tipType: tip_type.TipType.COMPLETE, |
532 | 536 | ); |
533 | 537 | break; |
534 | 538 | } |
|
0 commit comments