diff --git a/lib/common/helper/tip_helper.dart b/lib/common/helper/tip_helper.dart index cc540e9..cf04635 100644 --- a/lib/common/helper/tip_helper.dart +++ b/lib/common/helper/tip_helper.dart @@ -1,6 +1,8 @@ +import 'package:ai_awesome_message/ai_awesome_message.dart' as awesome_message; +import 'package:airoute/airoute.dart'; import 'package:flutter/material.dart'; -import 'package:flushbar/flushbar.dart'; -import 'tip_type.dart'; + +import 'tip_type.dart' as tip_type; /// /// TipHelper @@ -15,90 +17,30 @@ class TipHelper { @required BuildContext context, String title, String message = '', - TipType tipType = TipType.INFO, + tip_type.TipType tipType = tip_type.TipType.INFO, }) { - List _tipStyleColorsSample = [ - Colors.blue[100], - Colors.orange[100], - Colors.red[100], - Colors.green[200] - ]; - List _tipIndicatorColorsSample = [ - Colors.blue[300], - Colors.orange[300], - Colors.red[300], - Colors.blue[300] - ]; - List _tipIconColorsSample = [ - Colors.blue[500], - Colors.orange[500], - Colors.red[500], - Colors.blue[500] - ]; - - IconData _tipIcon; - Color _tipStyleColor; - Color _tipStyleIconColor; - Color _tipStyleBorderColor; - if (tipType == TipType.INFO) { - title = title ?? "提示"; - _tipIcon = Icons.info_outline; - _tipStyleColor = Colors.blue[100]; - _tipStyleIconColor = Colors.blue[500]; - _tipStyleBorderColor = Colors.blue[300]; - } else if (tipType == TipType.WARN) { - title = title ?? "警告"; - _tipIcon = Icons.error_outline; - _tipStyleColor = Colors.orange[100]; - _tipStyleIconColor = Colors.orange[500]; - _tipStyleBorderColor = Colors.orange[300]; - } else if (tipType == TipType.ERROR) { - title = title ?? "错误"; - _tipIcon = Icons.cancel; - _tipStyleColor = Colors.red[100]; - _tipStyleIconColor = Colors.red[500]; - _tipStyleBorderColor = Colors.red[300]; - } else if (tipType == TipType.COMPLETE) { - title = title ?? "完成"; - _tipIcon = Icons.check_circle; - _tipStyleColor = Colors.green[100]; - _tipStyleIconColor = Colors.green[500]; - _tipStyleBorderColor = Colors.green[300]; + awesome_message.TipType awesomeTipType; + if (tipType == tip_type.TipType.INFO) { + awesomeTipType = awesome_message.TipType.INFO; + } else if (tipType == tip_type.TipType.WARN) { + awesomeTipType = awesome_message.TipType.WARN; + } else if (tipType == tip_type.TipType.ERROR) { + awesomeTipType = awesome_message.TipType.ERROR; + } else if (tipType == tip_type.TipType.COMPLETE) { + awesomeTipType = awesome_message.TipType.COMPLETE; } else { - title = title ?? "默认"; - _tipIcon = Icons.info_outline; - _tipStyleColor = Colors.blue[100]; - _tipStyleIconColor = Colors.blue[500]; - _tipStyleBorderColor = Colors.blue[300]; + awesomeTipType = awesome_message.TipType.INFO; } - - Flushbar( - titleText: Text( - "${title ?? '提示'}", - style: TextStyle( - color: Colors.black87, + Airoute.push( + route: awesome_message.AwesomeMessageRoute( + theme: null, + settings: RouteSettings(name: "/ai_awesome_message"), + awesomeMessage: awesome_message.AwesomeHelper.createAwesome( + title: "$title", + message: "$message", + tipType: awesomeTipType, ), ), - messageText: Text( - "${message ?? '提示'}", - style: TextStyle( - color: Colors.black54, - ), - ), - icon: Icon( - _tipIcon, - size: 28.0, - color: _tipStyleIconColor, - ), - duration: Duration( - seconds: 2, - ), - flushbarPosition: FlushbarPosition.TOP, - shouldIconPulse: true, - showProgressIndicator: false, - flushbarStyle: FlushbarStyle.GROUNDED, - backgroundColor: _tipStyleColor, - borderColor: _tipStyleBorderColor, - )..show(context); + ); } } diff --git a/lib/sample/chart/bar_chart/samples/bar_chart_sample5.dart b/lib/sample/chart/bar_chart/samples/bar_chart_sample5.dart index c67b12c..e146fb9 100644 --- a/lib/sample/chart/bar_chart/samples/bar_chart_sample5.dart +++ b/lib/sample/chart/bar_chart/samples/bar_chart_sample5.dart @@ -98,7 +98,8 @@ class BarChartSample5State extends State { checkToShowHorizontalLine: (value) => value % 5 == 0, getDrawingHorizontalLine: (value) { if (value == 0) { - return const FlLine(color: Color(0xff363753), strokeWidth: 3); + return const FlLine( + color: Color(0xff363753), strokeWidth: 3); } return const FlLine( color: Color(0xff2a2747), @@ -110,7 +111,7 @@ class BarChartSample5State extends State { show: false, ), barGroups: [ - const BarChartGroupData( + BarChartGroupData( x: 0, barRods: [ BarChartRodData( @@ -128,7 +129,7 @@ class BarChartSample5State extends State { ), ], ), - const BarChartGroupData( + BarChartGroupData( x: 1, barRods: [ BarChartRodData( @@ -146,7 +147,7 @@ class BarChartSample5State extends State { ), ], ), - const BarChartGroupData( + BarChartGroupData( x: 2, barRods: [ BarChartRodData( @@ -164,7 +165,7 @@ class BarChartSample5State extends State { ), ], ), - const BarChartGroupData( + BarChartGroupData( x: 3, barRods: [ BarChartRodData( @@ -182,7 +183,7 @@ class BarChartSample5State extends State { ), ], ), - const BarChartGroupData( + BarChartGroupData( x: 4, barRods: [ BarChartRodData( @@ -200,7 +201,7 @@ class BarChartSample5State extends State { ), ], ), - const BarChartGroupData( + BarChartGroupData( x: 5, barRods: [ BarChartRodData( @@ -218,7 +219,7 @@ class BarChartSample5State extends State { ), ], ), - const BarChartGroupData( + BarChartGroupData( x: 6, barRods: [ BarChartRodData( diff --git a/lib/sample/text/input_text_page.dart b/lib/sample/text/input_text_page.dart new file mode 100644 index 0000000..41f5a82 --- /dev/null +++ b/lib/sample/text/input_text_page.dart @@ -0,0 +1,23 @@ +import 'package:flutter/material.dart'; + +/// +/// InputTextPage +class InputTextPage extends StatefulWidget { + @override + State createState() { + return _InputTextState(); + } +} + +/// +/// _InputTextState +class _InputTextState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text("InputText"), + ), + ); + } +} diff --git a/lib/sample/tip/flushbar_page.dart b/lib/sample/tip/flushbar_page.dart index 7fb3d29..176c83e 100644 --- a/lib/sample/tip/flushbar_page.dart +++ b/lib/sample/tip/flushbar_page.dart @@ -1,8 +1,9 @@ +import 'package:ai_awesome_message/ai_awesome_message.dart'; +import 'package:airoute/airoute.dart'; import 'package:flutter/material.dart'; -import 'package:flushbar/flushbar.dart'; import '../../common/helper/tip_helper.dart'; -import '../../common/helper/tip_type.dart'; +import '../../common/helper/tip_type.dart' as tip_type; /// /// FlushBarPage @@ -116,14 +117,14 @@ class _FlushBarToolState extends State { IconData _tipIconData = Icons.info_outline; List _tipStyleSelected = [true, false]; - List _tipStyleValues = [ - FlushbarStyle.GROUNDED, - FlushbarStyle.FLOATING + List _tipStyleValues = [ + AwesomeMessageStyle.GROUNDED, + AwesomeMessageStyle.FLOATING ]; - FlushbarStyle _tipStyleValue = FlushbarStyle.GROUNDED; + AwesomeMessageStyle _tipStyleValue = AwesomeMessageStyle.GROUNDED; - Widget _getFlushBar() { - return Flushbar( + Widget _getAwesomeMessage() { + return AwesomeMessage( title: "${_tipTitle ?? 'title'}", titleText: Text( "${_tipTitle ?? '提示'}", @@ -151,10 +152,10 @@ class _FlushBarToolState extends State { : _tipSecondDuration), borderRadius: _tipBorderRadius, margin: EdgeInsets.all(_tipMargin), - flushbarPosition: FlushbarPosition.TOP, + awesomeMessagePosition: AwesomeMessagePosition.TOP, shouldIconPulse: _tipIconPulse, showProgressIndicator: _tipShowProgress, - flushbarStyle: _tipStyleValue, + awesomeMessageStyle: _tipStyleValue, backgroundColor: _tipStyleBackgroundColor, borderColor: _tipStyleBorderColor, progressIndicatorBackgroundColor: _tipIndicatorColor, @@ -257,7 +258,7 @@ class _FlushBarToolState extends State { ), ], ), - _getFlushBar(), + _getAwesomeMessage(), ], ), ), @@ -415,9 +416,12 @@ class _FlushBarToolState extends State { ), floatingActionButton: FloatingActionButton( onPressed: () { - Widget flushBarWidget = _getFlushBar(); - if (flushBarWidget is Flushbar) { - flushBarWidget..show(context); + Widget awesomeMessageWidget = _getAwesomeMessage(); + if (awesomeMessageWidget is AwesomeMessage) { + Airoute.push( + route: AwesomeMessageRoute( + theme: null, awesomeMessage: awesomeMessageWidget), + ); } }, child: Icon(Icons.slideshow), @@ -504,7 +508,7 @@ class _FlushBarStyleState extends State { context: context, title: "Info", message: "message", - tipType: TipType.INFO, + tipType: tip_type.TipType.INFO, ); break; case 1: @@ -512,7 +516,7 @@ class _FlushBarStyleState extends State { context: context, title: "Warn", message: "message", - tipType: TipType.WARN, + tipType: tip_type.TipType.WARN, ); break; case 2: @@ -520,7 +524,7 @@ class _FlushBarStyleState extends State { context: context, title: "Error", message: "message", - tipType: TipType.ERROR, + tipType: tip_type.TipType.ERROR, ); break; case 3: @@ -528,7 +532,7 @@ class _FlushBarStyleState extends State { context: context, title: "Done", message: "message", - tipType: TipType.COMPLETE, + tipType: tip_type.TipType.COMPLETE, ); break; } diff --git a/pubspec.yaml b/pubspec.yaml index a1fa290..4bad839 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -36,9 +36,7 @@ dependencies: # Barcode package. # ai_barcode: ^0.2.7 - ai_barcode: - git: - url: https://github.com/pdliuw/ai_barcode.git + ai_barcode: ^1.0.3 # Http package. # ai_http: ^0.1.1 @@ -55,7 +53,7 @@ dependencies: snappable: ^1.0.1 # tip - flushbar: ^1.9.1 + ai_awesome_message: ^0.1.0-pre # drawing drawing_animation: ^0.1.3