diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b8c0e59..0f588ea9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,6 @@ - **Breaking change**: Sound null safety support, thanks to @leftcoding #39#33 @donywan #20 @laiiihz #80#64#59#32#14 @kalifun #36 @jojinshallar #81#75#65#62#56#42 @junlandroid #73 @Kenneth #53 @HappyImp #55 @kkkman22 #23 @AlexV525 #30 - **Breaking change**: Refer to the dart language specification to optimized constant and enum naming. - Replace DIN Font with Bebas Font . -- Add build test thank to **AlexV525**. #### components - **Breaking change**: remove BrnHorizontalStepsManager and put function forwardStep() backStep() into BrnStepsController thanks to leftcoding. @@ -14,8 +13,9 @@ - BrnSelectionEntityListBean: fromMap is renamed to fromJson. - BrnRadioButton: optimize click area [#31](https://github.com/LianjiaTech/bruno/pull/31) , thanks to **a1017480401** . - BrnScrollableTextDialog: remove Navigator.pop(context) in onSubmit() and hand it over to external processing (user). -- BrnBubbleText: add attribute bgColor and textStyle -- BrnPairInfoTable: add attribute defaultVerticalAlignment +- BrnBubbleText: add attribute bgColor and textStyle. +- BrnPairInfoTable: add attribute defaultVerticalAlignment. +- BrnDialog: remove BrnDialogStyle and replace with BrnDialogConfig. diff --git a/example/lib/main.dart b/example/lib/main.dart index dff77517..202b0652 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,5 +1,3 @@ - - import 'package:example/sample/home/home.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/actionsheet/actionsheet_entry_page.dart b/example/lib/sample/components/actionsheet/actionsheet_entry_page.dart index 7ce508f2..88d57b90 100644 --- a/example/lib/sample/components/actionsheet/actionsheet_entry_page.dart +++ b/example/lib/sample/components/actionsheet/actionsheet_entry_page.dart @@ -1,5 +1,3 @@ - - import 'dart:async'; import 'package:bruno/bruno.dart'; @@ -157,18 +155,18 @@ class _ActionSheetEntryPageState extends State { }); } - void _showCommonStylex(){ + void _showCommonStylex() { List actions = []; // 构建标题+辅助信息的普通项 actions.add(BrnCommonActionSheetItem( - '选项一(警示项)', - desc:'辅助信息辅助信息辅助信息辅助信息', + '选项一(警示项)', + desc: '辅助信息辅助信息辅助信息辅助信息', actionStyle: BrnCommonActionSheetItemStyle.alert, )); // 构建标题+辅助信息的普通项 actions.add(BrnCommonActionSheetItem( - '选项二', - desc:'辅助信息辅助信息辅助信息', + '选项二', + desc: '辅助信息辅助信息辅助信息', actionStyle: BrnCommonActionSheetItemStyle.normal, )); // 构建只有标题的普通项 @@ -189,7 +187,6 @@ class _ActionSheetEntryPageState extends State { }, ); }); - } void _showCommonStyle1(BuildContext context) { @@ -260,7 +257,7 @@ class _ActionSheetEntryPageState extends State { } void _showCommonCustomStyle(BuildContext context) { - List actions =[]; + List actions = []; actions.add( BrnCommonActionSheetItem( '选项一: 自定义主标题样式', @@ -354,7 +351,8 @@ class _ActionSheetEntryPageState extends State { backgroundColor: Colors.transparent, builder: (BuildContext context) { // 通过statefulBuilder可以实现动态变换选项文案(本example只作为使用参考,请根据具体情况选择方式) - return StatefulBuilder(builder: (BuildContext context, StateSetter setState) { + return StatefulBuilder( + builder: (BuildContext context, StateSetter setState) { if (!started) { started = true; // 设置timer,每1秒循环一次 @@ -428,7 +426,8 @@ class _ActionSheetEntryPageState extends State { firstShareChannels: firstRowList, clickCallBack: (int section, int index, BrnShareItem shareItem) { int channel = shareItem.shareType; - BrnToast.show("channel: $channel, section: $section, index: $index", context); + BrnToast.show( + "channel: $channel, section: $section, index: $index", context); }, cancelTitle: "自定义取消名字", // 取消按钮title可自定义 ); @@ -475,7 +474,8 @@ class _ActionSheetEntryPageState extends State { secondShareChannels: secondRowList, clickCallBack: (int section, int index, BrnShareItem shareItem) { int channel = shareItem.shareType; - BrnToast.show("channel: $channel, section: $section, index: $index", context); + BrnToast.show( + "channel: $channel, section: $section, index: $index", context); }, clickInterceptor: (int section, int index, BrnShareItem shareItem) { if (shareItem.canClick) { @@ -491,7 +491,7 @@ class _ActionSheetEntryPageState extends State { void _showShareThreeStyle(BuildContext context) { List firstRowList = []; - List secondRowList =[]; + List secondRowList = []; firstRowList.add(BrnShareItem( BrnShareItemConstants.shareWeiXin, canClick: true, @@ -511,7 +511,8 @@ class _ActionSheetEntryPageState extends State { secondShareChannels: secondRowList, clickCallBack: (int section, int index, BrnShareItem shareItem) { int channel = shareItem.shareType; - BrnToast.show("channel: $channel, section: $section, index: $index", context); + BrnToast.show( + "channel: $channel, section: $section, index: $index", context); }, ); actionSheet.show(context); @@ -531,7 +532,8 @@ class _ActionSheetEntryPageState extends State { firstShareChannels: firstRowList, clickCallBack: (int section, int index, BrnShareItem shareItem) { int channel = shareItem.shareType; - BrnToast.show("channel: $channel, section: $section, index: $index", context); + BrnToast.show( + "channel: $channel, section: $section, index: $index", context); }, ); actionSheet.show(context); diff --git a/example/lib/sample/components/actionsheet/actionsheet_selected_list_custom_example.dart b/example/lib/sample/components/actionsheet/actionsheet_selected_list_custom_example.dart index 283dc591..e2fc5ba2 100644 --- a/example/lib/sample/components/actionsheet/actionsheet_selected_list_custom_example.dart +++ b/example/lib/sample/components/actionsheet/actionsheet_selected_list_custom_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/actionsheet/actionsheet_selected_list_example.dart b/example/lib/sample/components/actionsheet/actionsheet_selected_list_example.dart index 9dd1c195..fd68e9ca 100644 --- a/example/lib/sample/components/actionsheet/actionsheet_selected_list_example.dart +++ b/example/lib/sample/components/actionsheet/actionsheet_selected_list_example.dart @@ -1,11 +1,10 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; class SelectedListActionSheetExamplePage extends StatefulWidget { @override - State createState() => SelectedListActionSheetExamplePageState(); + State createState() => + SelectedListActionSheetExamplePageState(); } class SelectedListActionSheetExamplePageState @@ -64,7 +63,7 @@ class SelectedListActionSheetExamplePageState if (!controller.isHidden) { controller.dismiss(); } else { - if ( _data.length <= 0) { + if (_data.length <= 0) { BrnToast.show('数据为空,弹窗不展示', context); return; } @@ -89,7 +88,8 @@ class SelectedListActionSheetExamplePageState ), ), ), - itemTitleBuilder: (int index, String? entity) { + itemTitleBuilder: + (int index, String? entity) { return entity; }, onClear: () { diff --git a/example/lib/sample/components/bottom_tabbar/bottom_tabbar_example.dart b/example/lib/sample/components/bottom_tabbar/bottom_tabbar_example.dart index 5cadf9f9..1c1d5f5d 100644 --- a/example/lib/sample/components/bottom_tabbar/bottom_tabbar_example.dart +++ b/example/lib/sample/components/bottom_tabbar/bottom_tabbar_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -11,7 +9,8 @@ class BottomTabbarExample extends StatefulWidget { } } -class BottomTabbarExampleState extends State with SingleTickerProviderStateMixin { +class BottomTabbarExampleState extends State + with SingleTickerProviderStateMixin { /// 选中的index int _selectedIndex = 0; @@ -97,24 +96,32 @@ class BottomTabbarExampleState extends State with SingleTic items: [ // 定义每个BottomTabBarItem,子属性请看源码 BrnBottomTabBarItem( - icon: Image(image: AssetImage("assets/icons/navbar_house.png")), - activeIcon: Image(image: AssetImage("assets/icons/navbar_house.png")), + icon: + Image(image: AssetImage("assets/icons/navbar_house.png")), + activeIcon: + Image(image: AssetImage("assets/icons/navbar_house.png")), title: Text(titles[0])), BrnBottomTabBarItem( - icon: Image(image: AssetImage("assets/icons/navbar_house.png")), + icon: + Image(image: AssetImage("assets/icons/navbar_house.png")), title: Text(titles[1])), BrnBottomTabBarItem( - icon: Image(image: AssetImage("assets/icons/navbar_house.png")), + icon: + Image(image: AssetImage("assets/icons/navbar_house.png")), title: Text(titles[2])), BrnBottomTabBarItem( - icon: Image(image: AssetImage("assets/icons/navbar_house.png")), - activeIcon: Image(image: AssetImage("assets/icons/navbar_house.png")), + icon: + Image(image: AssetImage("assets/icons/navbar_house.png")), + activeIcon: + Image(image: AssetImage("assets/icons/navbar_house.png")), title: Text(titles[3])), BrnBottomTabBarItem( - icon: Image(image: AssetImage("assets/icons/navbar_house.png")), + icon: + Image(image: AssetImage("assets/icons/navbar_house.png")), title: Text(titles[4])), BrnBottomTabBarItem( - icon: Image(image: AssetImage("assets/icons/navbar_house.png")), + icon: + Image(image: AssetImage("assets/icons/navbar_house.png")), title: Text(titles[5])), ], ), @@ -129,7 +136,8 @@ class BottomTabbarExampleState extends State with SingleTic currentIndex: _selectedIndexTest1, onTap: _onItemSelectedTest1, items: [ - BrnBottomTabBarItem(icon: Icon(icons[0]), title: Text(titles[0])), + BrnBottomTabBarItem( + icon: Icon(icons[0]), title: Text(titles[0])), ], ), Padding( @@ -141,14 +149,22 @@ class BottomTabbarExampleState extends State with SingleTic currentIndex: _selectedIndexTest2, onTap: _onItemSelectedTest2, items: [ - BrnBottomTabBarItem(icon: Icon(icons[0]), title: Text(titles[0])), - BrnBottomTabBarItem(icon: Icon(icons[0]), title: Text(titles[0])), - BrnBottomTabBarItem(icon: Icon(icons[0]), title: Text(titles[0])), - BrnBottomTabBarItem(icon: Icon(icons[0]), title: Text(titles[0])), - BrnBottomTabBarItem(icon: Icon(icons[0]), title: Text(titles[0])), - BrnBottomTabBarItem(icon: Icon(icons[0]), title: Text(titles[0])), - BrnBottomTabBarItem(icon: Icon(icons[0]), title: Text(titles[0])), - BrnBottomTabBarItem(icon: Icon(icons[0]), title: Text(titles[0])), + BrnBottomTabBarItem( + icon: Icon(icons[0]), title: Text(titles[0])), + BrnBottomTabBarItem( + icon: Icon(icons[0]), title: Text(titles[0])), + BrnBottomTabBarItem( + icon: Icon(icons[0]), title: Text(titles[0])), + BrnBottomTabBarItem( + icon: Icon(icons[0]), title: Text(titles[0])), + BrnBottomTabBarItem( + icon: Icon(icons[0]), title: Text(titles[0])), + BrnBottomTabBarItem( + icon: Icon(icons[0]), title: Text(titles[0])), + BrnBottomTabBarItem( + icon: Icon(icons[0]), title: Text(titles[0])), + BrnBottomTabBarItem( + icon: Icon(icons[0]), title: Text(titles[0])), ], ), Padding( @@ -160,14 +176,22 @@ class BottomTabbarExampleState extends State with SingleTic currentIndex: _selectedIndexTest3, onTap: _onItemSelectedTest3, items: [ - BrnBottomTabBarItem(icon: Icon(icons[0]), title: Text("1111111111")), - BrnBottomTabBarItem(icon: Icon(icons[0]), title: Text("2222222222")), - BrnBottomTabBarItem(icon: Icon(icons[0]), title: Text("3333333333")), - BrnBottomTabBarItem(icon: Icon(icons[0]), title: Text("4444444444")), - BrnBottomTabBarItem(icon: Icon(icons[0]), title: Text("5555555555")), - BrnBottomTabBarItem(icon: Icon(icons[0]), title: Text("6666666666")), - BrnBottomTabBarItem(icon: Icon(icons[0]), title: Text("7777777777")), - BrnBottomTabBarItem(icon: Icon(icons[0]), title: Text("8888888888")), + BrnBottomTabBarItem( + icon: Icon(icons[0]), title: Text("1111111111")), + BrnBottomTabBarItem( + icon: Icon(icons[0]), title: Text("2222222222")), + BrnBottomTabBarItem( + icon: Icon(icons[0]), title: Text("3333333333")), + BrnBottomTabBarItem( + icon: Icon(icons[0]), title: Text("4444444444")), + BrnBottomTabBarItem( + icon: Icon(icons[0]), title: Text("5555555555")), + BrnBottomTabBarItem( + icon: Icon(icons[0]), title: Text("6666666666")), + BrnBottomTabBarItem( + icon: Icon(icons[0]), title: Text("7777777777")), + BrnBottomTabBarItem( + icon: Icon(icons[0]), title: Text("8888888888")), ], ), ], diff --git a/example/lib/sample/components/button/bottom_button_entry_page.dart b/example/lib/sample/components/button/bottom_button_entry_page.dart index 314ceeb8..9bead413 100644 --- a/example/lib/sample/components/button/bottom_button_entry_page.dart +++ b/example/lib/sample/components/button/bottom_button_entry_page.dart @@ -22,7 +22,8 @@ class BottomButtonEntryWidget extends StatelessWidget { isShowLine: false, describeColor: Color(0xFF222222), onPressed: () { - Navigator.of(context).push(MaterialPageRoute(builder: (context) { + Navigator.of(context) + .push(MaterialPageRoute(builder: (context) { return BrnCommonBottomExample(); })); }, @@ -32,7 +33,8 @@ class BottomButtonEntryWidget extends StatelessWidget { describe: '全选、已选、主按钮、次按钮', describeColor: Color(0xFF222222), onPressed: () { - Navigator.of(context).push(MaterialPageRoute(builder: (context) { + Navigator.of(context) + .push(MaterialPageRoute(builder: (context) { return BrnSelectionBottomButtonExample(); })); }, diff --git a/example/lib/sample/components/button/button_entry_page.dart b/example/lib/sample/components/button/button_entry_page.dart index c851ed43..bf461842 100644 --- a/example/lib/sample/components/button/button_entry_page.dart +++ b/example/lib/sample/components/button/button_entry_page.dart @@ -28,7 +28,8 @@ class ButtonEntryPage extends StatelessWidget { isSupportTheme: true, describeColor: Color(0xFF222222), onPressed: () { - Navigator.of(context).push(MaterialPageRoute(builder: (context) { + Navigator.of(context) + .push(MaterialPageRoute(builder: (context) { return BigMainButtonExample(); })); }, @@ -39,7 +40,8 @@ class ButtonEntryPage extends StatelessWidget { describe: '宽度为屏幕宽度,背景色为白色,带有边框线', describeColor: Color(0xFF222222), onPressed: () { - Navigator.of(context).push(MaterialPageRoute(builder: (context) { + Navigator.of(context) + .push(MaterialPageRoute(builder: (context) { return BigOutlineButtonExample(); })); }, @@ -49,7 +51,8 @@ class ButtonEntryPage extends StatelessWidget { describe: '宽度为屏幕宽度,背景色为次级辅助色', describeColor: Color(0xFF222222), onPressed: () { - Navigator.of(context).push(MaterialPageRoute(builder: (context) { + Navigator.of(context) + .push(MaterialPageRoute(builder: (context) { return BigFuButtonExample(); })); }, @@ -60,7 +63,8 @@ class ButtonEntryPage extends StatelessWidget { describe: '宽度为屏幕宽度,背景色为浅主题色', describeColor: Color(0xFF222222), onPressed: () { - Navigator.of(context).push(MaterialPageRoute(builder: (context) { + Navigator.of(context) + .push(MaterialPageRoute(builder: (context) { return BigGhostButtonExample(); })); }, @@ -71,7 +75,8 @@ class ButtonEntryPage extends StatelessWidget { isSupportTheme: true, describeColor: Color(0xFF222222), onPressed: () { - Navigator.of(context).push(MaterialPageRoute(builder: (context) { + Navigator.of(context) + .push(MaterialPageRoute(builder: (context) { return BrnSmallMainButtonExample(); })); }, @@ -82,12 +87,12 @@ class ButtonEntryPage extends StatelessWidget { describe: '最小宽度为84,宽度自适应文字', describeColor: Color(0xFF222222), onPressed: () { - Navigator.of(context).push(MaterialPageRoute(builder: (context) { + Navigator.of(context) + .push(MaterialPageRoute(builder: (context) { return BrnSmallOutlineButtonExample(); })); }, ), - ], ), ), diff --git a/example/lib/sample/components/button/button_panel_entry_page.dart b/example/lib/sample/components/button/button_panel_entry_page.dart index 3d6ef593..61e9c2f6 100644 --- a/example/lib/sample/components/button/button_panel_entry_page.dart +++ b/example/lib/sample/components/button/button_panel_entry_page.dart @@ -4,8 +4,7 @@ import 'package:example/sample/components/button/button_panel_example.dart'; import 'package:example/sample/home/list_item.dart'; import 'package:flutter/material.dart'; -class ButtonPanelEntryPage extends StatelessWidget{ - +class ButtonPanelEntryPage extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( @@ -23,7 +22,8 @@ class ButtonPanelEntryPage extends StatelessWidget{ isShowLine: false, describeColor: Color(0xFF222222), onPressed: () { - Navigator.of(context).push(MaterialPageRoute(builder: (context) { + Navigator.of(context) + .push(MaterialPageRoute(builder: (context) { return ButtonPanelExample(); })); }, @@ -33,7 +33,8 @@ class ButtonPanelEntryPage extends StatelessWidget{ describe: '文本类型按钮集合', describeColor: Color(0xFF222222), onPressed: () { - Navigator.of(context).push(MaterialPageRoute(builder: (context) { + Navigator.of(context) + .push(MaterialPageRoute(builder: (context) { return BrnTextButtonPanelExample(); })); }, diff --git a/example/lib/sample/components/button/common_collection_example.dart b/example/lib/sample/components/button/common_collection_example.dart index da249615..ebab07a9 100644 --- a/example/lib/sample/components/button/common_collection_example.dart +++ b/example/lib/sample/components/button/common_collection_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/button/icon_button_example.dart b/example/lib/sample/components/button/icon_button_example.dart index b67f415e..cceae256 100644 --- a/example/lib/sample/components/button/icon_button_example.dart +++ b/example/lib/sample/components/button/icon_button_example.dart @@ -8,7 +8,8 @@ class BrnIconBtnExample extends StatefulWidget { _BrnIconBtnExampleState createState() => _BrnIconBtnExampleState(); } -class _BrnIconBtnExampleState extends State with TickerProviderStateMixin { +class _BrnIconBtnExampleState extends State + with TickerProviderStateMixin { @override Widget build(BuildContext context) { return Scaffold( diff --git a/example/lib/sample/components/button/selection_collection_example.dart b/example/lib/sample/components/button/selection_collection_example.dart index 42723669..b6dd10a8 100644 --- a/example/lib/sample/components/button/selection_collection_example.dart +++ b/example/lib/sample/components/button/selection_collection_example.dart @@ -3,11 +3,12 @@ import 'package:flutter/material.dart'; class BrnSelectionBottomButtonExample extends StatefulWidget { @override - _BrnSelectionBottomButtonExampleState createState() => _BrnSelectionBottomButtonExampleState(); + _BrnSelectionBottomButtonExampleState createState() => + _BrnSelectionBottomButtonExampleState(); } -class _BrnSelectionBottomButtonExampleState extends State { - +class _BrnSelectionBottomButtonExampleState + extends State { BrnMultipleBottomController controller = BrnMultipleBottomController(); @override @@ -83,7 +84,8 @@ class _BrnSelectionBottomButtonExampleState extends State { children: [ Text( '规则', - style: - TextStyle(color: Color(0xFF222222), fontSize: 28, fontWeight: FontWeight.bold), + style: TextStyle( + color: Color(0xFF222222), + fontSize: 28, + fontWeight: FontWeight.bold), ), BrnBubbleText( maxLines: 2, @@ -92,7 +92,7 @@ class _BrnShadowExampleState extends State { } Color getRandomColor() { - return Color.fromARGB( - Random().nextInt(255), Random().nextInt(255), Random().nextInt(255), Random().nextInt(255)); + return Color.fromARGB(Random().nextInt(255), Random().nextInt(255), + Random().nextInt(255), Random().nextInt(255)); } } diff --git a/example/lib/sample/components/card/bubble/brn_expanded_bubble_example.dart b/example/lib/sample/components/card/bubble/brn_expanded_bubble_example.dart index 46b50a47..687f33f0 100644 --- a/example/lib/sample/components/card/bubble/brn_expanded_bubble_example.dart +++ b/example/lib/sample/components/card/bubble/brn_expanded_bubble_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -27,7 +25,6 @@ class BrnBubbleExample2 extends StatelessWidget { maxLines: 3, text: '支持指定行数的展开收起,背景边框的圆角是4,左上角是特殊的形状,\n ' '文本的字号是14,颜色为深色', - ), Text( '正常案例', @@ -39,7 +36,7 @@ class BrnBubbleExample2 extends StatelessWidget { BrnBubbleText( maxLines: 2, text: '推荐理由:“满五唯一”“临近地铁”“首付低”,多出折行显示,文字展开的样式文式文文字展开的样式文式文。问我', - onExpanded: (isExpanded){ + onExpanded: (isExpanded) { String str = isExpanded ? "展开了" : "收起了"; BrnToast.show("我$str", context); }, @@ -53,7 +50,8 @@ class BrnBubbleExample2 extends StatelessWidget { ), BrnBubbleText( maxLines: 2, - text: '推荐理由:“满五唯一”“临近地铁”“首付低”,多出折行显示,文字展开的样式文。按钮的文案特别长按钮的文案特别长按钮的文案特别长按钮的文案特别长', + text: + '推荐理由:“满五唯一”“临近地铁”“首付低”,多出折行显示,文字展开的样式文。按钮的文案特别长按钮的文案特别长按钮的文案特别长按钮的文案特别长', ), Text( '异常案例文案过少', diff --git a/example/lib/sample/components/card/bubble/bubble_entry_page.dart b/example/lib/sample/components/card/bubble/bubble_entry_page.dart index 66346dcd..386008be 100644 --- a/example/lib/sample/components/card/bubble/bubble_entry_page.dart +++ b/example/lib/sample/components/card/bubble/bubble_entry_page.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:example/sample/components/card/bubble/common_bubble_example.dart'; import 'package:example/sample/components/card/bubble/brn_expanded_bubble_example.dart'; @@ -8,36 +6,39 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class BubbleEntryPage extends StatelessWidget { - @override Widget build(BuildContext context) { return Scaffold( appBar: BrnAppBar( title: "气泡示例", - ),body: ListView(children: [ - ListItem( - title: "普通气泡", - isShowLine: false, - describe: '通栏分割线', - onPressed: () { - Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) { - return BubbleExample(); - }, - )); - }, ), - ListItem( - title: "展开收起气泡", - describe: '左右有20dp间距的分割线', - onPressed: () { - Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) { - return BrnBubbleExample2(); + body: ListView( + children: [ + ListItem( + title: "普通气泡", + isShowLine: false, + describe: '通栏分割线', + onPressed: () { + Navigator.push(context, MaterialPageRoute( + builder: (BuildContext context) { + return BubbleExample(); + }, + )); + }, + ), + ListItem( + title: "展开收起气泡", + describe: '左右有20dp间距的分割线', + onPressed: () { + Navigator.push(context, MaterialPageRoute( + builder: (BuildContext context) { + return BrnBubbleExample2(); + }, + )); }, - )); - }, + ), + ], ), - ],),); + ); } } diff --git a/example/lib/sample/components/card/bubble/common_bubble_example.dart b/example/lib/sample/components/card/bubble/common_bubble_example.dart index 0468c77a..06d53c24 100644 --- a/example/lib/sample/components/card/bubble/common_bubble_example.dart +++ b/example/lib/sample/components/card/bubble/common_bubble_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -46,7 +44,8 @@ class BubbleExample extends StatelessWidget { ), ), BrnInsertInfo( - infoText: '推荐理由:“满五唯一”“临近地铁”“首付低”,多出折行显示,文字展开的样式文。按钮的文案特别长按钮的文案特别长按钮的文案特别长按钮的文案特别长', + infoText: + '推荐理由:“满五唯一”“临近地铁”“首付低”,多出折行显示,文字展开的样式文。按钮的文案特别长按钮的文案特别长按钮的文案特别长按钮的文案特别长', ), Text( '异常案例文案过少', diff --git a/example/lib/sample/components/card/content/brn_two_rich_content_example.dart b/example/lib/sample/components/card/content/brn_two_rich_content_example.dart index 36f082ef..6062e2f0 100644 --- a/example/lib/sample/components/card/content/brn_two_rich_content_example.dart +++ b/example/lib/sample/components/card/content/brn_two_rich_content_example.dart @@ -1,11 +1,10 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; class BrnTwoRichContentExample extends StatefulWidget { @override - _BrnTwoRichContentExampleState createState() => _BrnTwoRichContentExampleState(); + _BrnTwoRichContentExampleState createState() => + _BrnTwoRichContentExampleState(); } class _BrnTwoRichContentExampleState extends State { @@ -23,7 +22,10 @@ class _BrnTwoRichContentExampleState extends State { children: [ Text( '规则', - style: TextStyle(color: Color(0xFF222222), fontSize: 28, fontWeight: FontWeight.bold), + style: TextStyle( + color: Color(0xFF222222), + fontSize: 28, + fontWeight: FontWeight.bold), ), BrnBubbleText( maxLines: 4, @@ -42,10 +44,12 @@ class _BrnTwoRichContentExampleState extends State { BrnRichGridInfo("名称:", '内容内容内容内容'), BrnRichGridInfo("名称:", '内容内容内容'), BrnRichGridInfo("名称:", '内容内容'), - BrnRichGridInfo.valueLastClickInfo('名称', '内容内容', keyQuestionCallback: (value) { + BrnRichGridInfo.valueLastClickInfo('名称', '内容内容', + keyQuestionCallback: (value) { BrnToast.show(value, context); }), - BrnRichGridInfo.valueLastClickInfo('名称', '内容内容', valueQuestionCallback: (value) { + BrnRichGridInfo.valueLastClickInfo('名称', '内容内容', + valueQuestionCallback: (value) { BrnToast.show(value, context); }), BrnRichGridInfo.valueLastClickInfo('名称', '内容内容', @@ -56,8 +60,8 @@ class _BrnTwoRichContentExampleState extends State { clickCallback: (value) { BrnToast.show(value, context); }), - BrnRichGridInfo.valueLastClickInfo('名称', '内容内容', clickTitle: "可点击内容", - clickCallback: (value) { + BrnRichGridInfo.valueLastClickInfo('名称', '内容内容', + clickTitle: "可点击内容", clickCallback: (value) { BrnToast.show(value, context); }), ], @@ -89,7 +93,8 @@ class _BrnTwoRichContentExampleState extends State { ), BrnRichInfoGrid( pairInfoList: [ - BrnRichGridInfo.valueLastClickInfo('名称名称', '内容内容内容内容内容内容内容内容内容内容内容', + BrnRichGridInfo.valueLastClickInfo( + '名称名称', '内容内容内容内容内容内容内容内容内容内容内容', keyQuestionCallback: (value) { BrnToast.show(value, context); }), @@ -108,7 +113,8 @@ class _BrnTwoRichContentExampleState extends State { BrnRichInfoGrid( pairInfoList: [ BrnRichGridInfo("名称名称:", '内容内容内容内容'), - BrnRichGridInfo.valueLastClickInfo("名称名称名称名称名称名称名称名称名称:", '内容内容内容内容内容内容内容内容内容内容内容'), + BrnRichGridInfo.valueLastClickInfo( + "名称名称名称名称名称名称名称名称名称:", '内容内容内容内容内容内容内容内容内容内容内容'), BrnRichGridInfo("名称:", '内容内容'), BrnRichGridInfo("名称:", '内容'), ], @@ -123,7 +129,8 @@ class _BrnTwoRichContentExampleState extends State { BrnRichInfoGrid( pairInfoList: [ BrnRichGridInfo("名称名称:", '内容内容内容内容'), - BrnRichGridInfo.valueLastClickInfo("名称名称名", '内容内容内容', clickTitle: '可点击内容可点击内容可点击内容', + BrnRichGridInfo.valueLastClickInfo("名称名称名", '内容内容内容', + clickTitle: '可点击内容可点击内容可点击内容', valueQuestionCallback: (value) { BrnToast.show(value, context); }), diff --git a/example/lib/sample/components/card/content/brn_two_text_content_example.dart b/example/lib/sample/components/card/content/brn_two_text_content_example.dart index 19ecbdff..c2dc745b 100644 --- a/example/lib/sample/components/card/content/brn_two_text_content_example.dart +++ b/example/lib/sample/components/card/content/brn_two_text_content_example.dart @@ -1,11 +1,10 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; class BrnTextRIchContentExample extends StatefulWidget { @override - _BrnTextRIchContentExampleState createState() => _BrnTextRIchContentExampleState(); + _BrnTextRIchContentExampleState createState() => + _BrnTextRIchContentExampleState(); } class _BrnTextRIchContentExampleState extends State { @@ -23,7 +22,10 @@ class _BrnTextRIchContentExampleState extends State { children: [ Text( '规则', - style: TextStyle(color: Color(0xFF222222), fontSize: 28, fontWeight: FontWeight.bold), + style: TextStyle( + color: Color(0xFF222222), + fontSize: 28, + fontWeight: FontWeight.bold), ), BrnBubbleText( maxLines: 4, @@ -86,7 +88,8 @@ class _BrnTextRIchContentExampleState extends State { rowSpace: 10, pairInfoList: [ BrnRichGridInfo("名称名称:", null), - BrnRichGridInfo("名称名称名称名称名称名称名称名称名称:", '内容内容内容内容内容内容内容内容内容内容内容'), + BrnRichGridInfo( + "名称名称名称名称名称名称名称名称名称:", '内容内容内容内容内容内容内容内容内容内容内容'), BrnRichGridInfo("名称:", '内容内容'), BrnRichGridInfo("名称:", ''), ], @@ -104,7 +107,8 @@ class _BrnTextRIchContentExampleState extends State { rowSpace: 10, pairInfoList: [ BrnRichGridInfo("名称名称:", null), - BrnRichGridInfo("名称名称名称名称名称名称名称名称名称:", '内容内容内容内容内容内容内容内容内容内容内容'), + BrnRichGridInfo( + "名称名称名称名称名称名称名称名称名称:", '内容内容内容内容内容内容内容内容内容内容内容'), BrnRichGridInfo("名称:", '内容内容'), BrnRichGridInfo("名称:", ''), ], @@ -125,7 +129,8 @@ class _BrnTextRIchContentExampleState extends State { rowSpace: 10, pairInfoList: [ BrnRichGridInfo("名称名称:", null), - BrnRichGridInfo("名称名称名称名称名称名称名称名称名称:", '内容内容内容内容内容内容内容内容内容内容内容'), + BrnRichGridInfo( + "名称名称名称名称名称名称名称名称名称:", '内容内容内容内容内容内容内容内容内容内容内容'), BrnRichGridInfo("名称:", '内容内容'), BrnRichGridInfo("名称:", ''), ], @@ -146,7 +151,8 @@ class _BrnTextRIchContentExampleState extends State { rowSpace: 10, pairInfoList: [ BrnRichGridInfo("名称名称:", null), - BrnRichGridInfo("名称名称名称名称名称名称名称名称名称:", '内容内容内容内容内容内容内容内容内容内容内容'), + BrnRichGridInfo( + "名称名称名称名称名称名称名称名称名称:", '内容内容内容内容内容内容内容内容内容内容内容'), BrnRichGridInfo("名称:", '内容内容'), BrnRichGridInfo("名称:", ''), ], @@ -169,14 +175,17 @@ class _BrnTextRIchContentExampleState extends State { child: Container( padding: EdgeInsets.all(20), decoration: BoxDecoration( - color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(12.0))), + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(12.0))), child: Column( children: [ BrnPairInfoTable( children: [ - BrnInfoModal(keyPart: "名称:", valuePart: "加粗的内容,文字样式可配置"), + BrnInfoModal( + keyPart: "名称:", valuePart: "加粗的内容,文字样式可配置"), BrnInfoModal(keyPart: "名称名:", valuePart: "没加粗的内容"), - BrnInfoModal(keyPart: "名称名称名:", valuePart: "内容内容内容内容内容"), + BrnInfoModal( + keyPart: "名称名称名:", valuePart: "内容内容内容内容内容"), BrnInfoModal( keyPart: "名称名称名称名称:", valuePart: "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容", @@ -189,7 +198,9 @@ class _BrnTextRIchContentExampleState extends State { BrnRichInfoGrid( themeData: BrnPairRichInfoGridConfig( keyTextStyle: BrnTextStyle( - fontSize: 16, fontWeight: FontWeight.w400, color: Color(0xff999999)), + fontSize: 16, + fontWeight: FontWeight.w400, + color: Color(0xff999999)), valueTextStyle: BrnTextStyle( fontSize: 16, fontWeight: FontWeight.w400, @@ -198,7 +209,8 @@ class _BrnTextRIchContentExampleState extends State { rowSpace: 10, pairInfoList: [ BrnRichGridInfo("正常的名称:", '正常的内容'), - BrnRichGridInfo("名称名称名称名称名称名称名称名称名称:", '内容内容内容内容内容内容内容内容内容内容内容'), + BrnRichGridInfo( + "名称名称名称名称名称名称名称名称名称:", '内容内容内容内容内容内容内容内容内容内容内容'), BrnRichGridInfo("名称:", '内容内容内容内容内容内容内容内容内容内容内容内容'), BrnRichGridInfo("名称:", ''), ], @@ -210,7 +222,8 @@ class _BrnTextRIchContentExampleState extends State { rowSpace: 10, pairInfoList: [ BrnRichGridInfo("加粗的名称:", '加粗的内容'), - BrnRichGridInfo("名称名称名称名称名称名称名称名称名称:", '内容内容内容内容内容内容内容内容内容内容内容'), + BrnRichGridInfo( + "名称名称名称名称名称名称名称名称名称:", '内容内容内容内容内容内容内容内容内容内容内容'), BrnRichGridInfo("名称:", '内容内容内容内容内容内容内容内容内容内容内容内容'), BrnRichGridInfo("名称:", ''), ], diff --git a/example/lib/sample/components/card/content/brn_two_text_expanded_example.dart b/example/lib/sample/components/card/content/brn_two_text_expanded_example.dart index fecd7223..618b9207 100644 --- a/example/lib/sample/components/card/content/brn_two_text_expanded_example.dart +++ b/example/lib/sample/components/card/content/brn_two_text_expanded_example.dart @@ -3,10 +3,12 @@ import 'package:flutter/material.dart'; class BrnTextExpandedContentExample extends StatefulWidget { @override - _BrnTextExpandedContentExampleState createState() => _BrnTextExpandedContentExampleState(); + _BrnTextExpandedContentExampleState createState() => + _BrnTextExpandedContentExampleState(); } -class _BrnTextExpandedContentExampleState extends State { +class _BrnTextExpandedContentExampleState + extends State { @override Widget build(BuildContext context) { return Scaffold( @@ -21,7 +23,10 @@ class _BrnTextExpandedContentExampleState extends State[ Text( '规则', - style: TextStyle(color: Color(0xFF222222), fontSize: 28, fontWeight: FontWeight.bold), + style: TextStyle( + color: Color(0xFF222222), + fontSize: 28, + fontWeight: FontWeight.bold), ), BrnBubbleText( maxLines: 4, diff --git a/example/lib/sample/components/card/content/keyvalue_align_content_example.dart b/example/lib/sample/components/card/content/keyvalue_align_content_example.dart index d959c039..39fd8fc7 100644 --- a/example/lib/sample/components/card/content/keyvalue_align_content_example.dart +++ b/example/lib/sample/components/card/content/keyvalue_align_content_example.dart @@ -1,5 +1,3 @@ - - import 'dart:math'; import 'package:bruno/bruno.dart'; @@ -23,8 +21,11 @@ class _TextContentExampleState extends State { BrnInfoModal(keyPart: "名称名称名:", valuePart: "内容内容内容内容内容"), BrnInfoModal(keyPart: "名称名称名:", valuePart: "内容内容内容内容内容"), BrnInfoModal(keyPart: "名称名称名:", valuePart: "内容内容内容内容内容"), - BrnInfoModal(keyPart: "名称名称名称名称:", valuePart: "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容"), - BrnInfoModal.valueLastClickInfo("名称名:", '内容内容内容内容内容', '可点击内容', clickCallback: (text) { + BrnInfoModal( + keyPart: "名称名称名称名称:", + valuePart: "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容"), + BrnInfoModal.valueLastClickInfo("名称名:", '内容内容内容内容内容', '可点击内容', + clickCallback: (text) { BrnToast.show(text!, context); }) ]; @@ -44,7 +45,10 @@ class _TextContentExampleState extends State { children: [ Text( '规则', - style: TextStyle(color: Color(0xFF222222), fontSize: 28, fontWeight: FontWeight.bold), + style: TextStyle( + color: Color(0xFF222222), + fontSize: 28, + fontWeight: FontWeight.bold), ), BrnBubbleText( maxLines: 4, @@ -210,7 +214,8 @@ class _TextContentExampleState extends State { BrnInfoModal(keyPart: "名称名:", valuePart: "内容内容内容内容内容"), BrnInfoModal(keyPart: "名称名称名:", valuePart: "内容内容内容内容内容"), BrnInfoModal( - keyPart: "名称名称名称名称:", valuePart: "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容"), + keyPart: "名称名称名称名称:", + valuePart: "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容"), ], ), Text( @@ -230,9 +235,10 @@ class _TextContentExampleState extends State { BrnInfoModal(keyPart: "名称名:", valuePart: "内容内容内容内容内容"), BrnInfoModal(keyPart: "名称名称名:", valuePart: "内容内容内容内容内容"), BrnInfoModal( - keyPart: "名称名称名称名称:", valuePart: "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容"), - BrnInfoModal.valueLastClickInfo("名称名:", '11111111', '22222222', - clickCallback: (text) { + keyPart: "名称名称名称名称:", + valuePart: "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容"), + BrnInfoModal.valueLastClickInfo( + "名称名:", '11111111', '22222222', clickCallback: (text) { BrnToast.show(text!, context); }), ], @@ -256,7 +262,8 @@ class _TextContentExampleState extends State { BrnInfoModal(keyPart: "名称名称名:", valuePart: "内容内容内容内容内容"), BrnInfoModal(keyPart: "名称名称名:", valuePart: "内容内容内容内容内容"), BrnInfoModal( - keyPart: "名称名称名称名称:", valuePart: "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容"), + keyPart: "名称名称名称名称:", + valuePart: "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容"), BrnInfoModal.valueLastClickInfo("名称名:", '内容内容内容内容内容', '可点击内容', clickCallback: (text) { BrnToast.show(text!, context); @@ -303,12 +310,17 @@ class _TextContentExampleState extends State { ), Transform.rotate( angle: pi, - child: BrunoTools.getAssetImage('icons/icon_up_arrow.png')), + child: BrunoTools.getAssetImage( + 'icons/icon_up_arrow.png')), ], ), decoration: BoxDecoration( gradient: LinearGradient( - colors: [Colors.white.withAlpha(100), Colors.white, Colors.white], + colors: [ + Colors.white.withAlpha(100), + Colors.white, + Colors.white + ], begin: Alignment.centerLeft, end: Alignment.centerRight, )), @@ -354,12 +366,17 @@ class _TextContentExampleState extends State { ), Transform.rotate( angle: pi, - child: BrunoTools.getAssetImage('icons/icon_down_arrow.png')), + child: BrunoTools.getAssetImage( + 'icons/icon_down_arrow.png')), ], ), decoration: BoxDecoration( gradient: LinearGradient( - colors: [Colors.white.withAlpha(100), Colors.white, Colors.white], + colors: [ + Colors.white.withAlpha(100), + Colors.white, + Colors.white + ], begin: Alignment.centerLeft, end: Alignment.centerRight, )), @@ -379,9 +396,11 @@ class _TextContentExampleState extends State { BrnInfoModal(keyPart: "名称:", valuePart: "内容内容内容内容"), BrnInfoModal(keyPart: "名称名:", valuePart: "内容内容内容内容内容"), BrnInfoModal( - keyPart: "11111111111111111111111111111111111:", valuePart: "内容内容内容内容内容"), + keyPart: "11111111111111111111111111111111111:", + valuePart: "内容内容内容内容内容"), BrnInfoModal(keyPart: "名称名称名:", valuePart: "内容内容内容内容内容"), - BrnInfoModal.valueLastClickInfo("名称十分的长名称十分的长名称十分的长名称十分的长:", '内容内容内容内容内容', '可点击内容', + BrnInfoModal.valueLastClickInfo( + "名称十分的长名称十分的长名称十分的长名称十分的长:", '内容内容内容内容内容', '可点击内容', clickCallback: (text) { BrnToast.show(text!, context); }), @@ -396,13 +415,18 @@ class _TextContentExampleState extends State { ), BrnAlignPairInfo( children: [ - BrnInfoModal(keyPart: "名称:", valuePart: "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容"), + BrnInfoModal( + keyPart: "名称:", + valuePart: "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容"), BrnInfoModal(keyPart: "名称名:", valuePart: "内容内容内容内容内容"), BrnInfoModal(keyPart: "名称正常:", valuePart: "内容内容内容内容内容"), - BrnInfoModal(keyPart: "名称名称名:", valuePart: "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容"), + BrnInfoModal( + keyPart: "名称名称名:", + valuePart: "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容"), BrnInfoModal.valueLastClickInfo( - "名称十分的长名称十分的长名称十分的长名称十分的长:", '内容内容内容内容内容', '可点击内容可点击内容可点击内容可点击内容可点击内容可点击内容', - clickCallback: (text) { + "名称十分的长名称十分的长名称十分的长名称十分的长:", + '内容内容内容内容内容', + '可点击内容可点击内容可点击内容可点击内容可点击内容可点击内容', clickCallback: (text) { BrnToast.show(text!, context); }), ], diff --git a/example/lib/sample/components/card/content/keyvalue_close_content_example.dart b/example/lib/sample/components/card/content/keyvalue_close_content_example.dart index 2d6d8053..7db9de8b 100644 --- a/example/lib/sample/components/card/content/keyvalue_close_content_example.dart +++ b/example/lib/sample/components/card/content/keyvalue_close_content_example.dart @@ -1,14 +1,14 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; class KeyTextCloseContentExample extends StatefulWidget { @override - _KeyTextCloseContentExampleState createState() => _KeyTextCloseContentExampleState(); + _KeyTextCloseContentExampleState createState() => + _KeyTextCloseContentExampleState(); } -class _KeyTextCloseContentExampleState extends State { +class _KeyTextCloseContentExampleState + extends State { @override Widget build(BuildContext context) { return Scaffold( @@ -23,7 +23,10 @@ class _KeyTextCloseContentExampleState extends State children: [ Text( '规则', - style: TextStyle(color: Color(0xFF222222), fontSize: 28, fontWeight: FontWeight.bold), + style: TextStyle( + color: Color(0xFF222222), + fontSize: 28, + fontWeight: FontWeight.bold), ), BrnBubbleText( maxLines: 4, @@ -88,8 +91,12 @@ class _KeyTextCloseContentExampleState extends State children: [ BrnInfoModal(keyPart: "名称:", valuePart: "内容内容内容内容"), BrnInfoModal(keyPart: "名称名:", valuePart: "内容内容内容内容内容"), - BrnInfoModal(keyPart: "名称十分的长名称十分的长名称十分的长名称十分的长:", valuePart: "内容内容内容内容内容"), - BrnInfoModal(keyPart: "名称十分的长名称十分的长名称十分的长名称十分的长十分的长:", valuePart: "内容内容内容内容内容"), + BrnInfoModal( + keyPart: "名称十分的长名称十分的长名称十分的长名称十分的长:", + valuePart: "内容内容内容内容内容"), + BrnInfoModal( + keyPart: "名称十分的长名称十分的长名称十分的长名称十分的长十分的长:", + valuePart: "内容内容内容内容内容"), BrnInfoModal(keyPart: "名称名称名:", valuePart: "内容内容内容内容内容"), ], ), @@ -103,10 +110,14 @@ class _KeyTextCloseContentExampleState extends State BrnPairInfoTable( isValueAlign: false, children: [ - BrnInfoModal(keyPart: "名称:", valuePart: "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容"), + BrnInfoModal( + keyPart: "名称:", + valuePart: "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容"), BrnInfoModal(keyPart: "名称名:", valuePart: "内容内容内容内容内容"), BrnInfoModal(keyPart: "名称正常:", valuePart: "内容内容内容内容内容"), - BrnInfoModal(keyPart: "名称名称名:", valuePart: "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容"), + BrnInfoModal( + keyPart: "名称名称名:", + valuePart: "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容"), BrnInfoModal( keyPart: "名称名称名:", valuePart: @@ -122,23 +133,29 @@ class _KeyTextCloseContentExampleState extends State ), BrnPairInfoTable( isValueAlign: false, - expandAtIndex:2, + expandAtIndex: 2, children: [ - BrnInfoModal(keyPart: "名称:", valuePart: "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容"), + BrnInfoModal( + keyPart: "名称:", + valuePart: "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容"), BrnInfoModal(keyPart: "名称名:", valuePart: "内容内容内容内容内容"), BrnInfoModal(keyPart: "名称正常:", valuePart: "内容内容内容内容内容"), - BrnInfoModal(keyPart: "名称名称名:", valuePart: "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容"), + BrnInfoModal( + keyPart: "名称名称名:", + valuePart: "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容"), BrnInfoModal( keyPart: "名称名称名:", valuePart: "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内"), - BrnInfoModal.valueLastClickInfo("名称十分的长名:", '内容内容内容内容内容', '可点击内容可点击内容可点击内容可点击内容', + BrnInfoModal.valueLastClickInfo( + "名称十分的长名:", '内容内容内容内容内容', '可点击内容可点击内容可点击内容可点击内容', clickCallback: (text) { BrnToast.show(text!, context); }), BrnInfoModal.valueLastClickInfo( - "名称十分的长名:", '内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容', '可点击内容可点击内容可点击内容可点击内容', - clickCallback: (text) { + "名称十分的长名:", + '内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容', + '可点击内容可点击内容可点击内容可点击内容', clickCallback: (text) { BrnToast.show(text!, context); }), ], diff --git a/example/lib/sample/components/card/content/number_item_example.dart b/example/lib/sample/components/card/content/number_item_example.dart index f1a4df94..0579e485 100644 --- a/example/lib/sample/components/card/content/number_item_example.dart +++ b/example/lib/sample/components/card/content/number_item_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -24,8 +22,10 @@ class _NumberItemRowExampleState extends State { children: [ Text( '规则', - style: - TextStyle(color: Color(0xFF222222), fontSize: 28, fontWeight: FontWeight.bold), + style: TextStyle( + color: Color(0xFF222222), + fontSize: 28, + fontWeight: FontWeight.bold), ), BrnBubbleText( maxLines: 4, @@ -164,7 +164,8 @@ class _NumberItemRowExampleState extends State { title: '主题定制可去掉分割线', number: '2', ), - BrnNumberInfoItemModel(title: '数字和描述文案字体都可配置', number: '3', lastDesc: '单位'), + BrnNumberInfoItemModel( + title: '数字和描述文案字体都可配置', number: '3', lastDesc: '单位'), BrnNumberInfoItemModel( title: '上下间距可配置', number: '5', @@ -235,7 +236,9 @@ class _NumberItemRowExampleState extends State { "自定义底部", maxLines: 2, style: TextStyle( - fontSize: 12, fontWeight: FontWeight.w400, color: Color(0xFF999999)), + fontSize: 12, + fontWeight: FontWeight.w400, + color: Color(0xFF999999)), overflow: TextOverflow.ellipsis, )), BrnNumberInfoItemModel( diff --git a/example/lib/sample/components/card/content/text_content_entry_page.dart b/example/lib/sample/components/card/content/text_content_entry_page.dart index e16e0aec..590e88e2 100644 --- a/example/lib/sample/components/card/content/text_content_entry_page.dart +++ b/example/lib/sample/components/card/content/text_content_entry_page.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:example/sample/components/card/content/keyvalue_align_content_example.dart'; import 'package:example/sample/components/card/content/keyvalue_close_content_example.dart'; @@ -13,103 +11,105 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class TextContentEntryPage extends StatelessWidget { - @override Widget build(BuildContext context) { return Scaffold( appBar: BrnAppBar( title: "文本内容示例", - ),body: ListView(children: [ - ListItem( - title: "单列左对齐", - isShowLine: false, - isSupportTheme: true, - describe: 'key宽度最多92,value是左对齐的', - onPressed: () { - Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) { - return TextContentExample(); - }, - )); - }, ), - ListItem( - title: "单列紧贴着key名", - isSupportTheme: true, - describe: 'Value紧贴着Key,Key和value都是一行展示', - onPressed: () { - Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) { - return KeyTextCloseContentExample(); + body: ListView( + children: [ + ListItem( + title: "单列左对齐", + isShowLine: false, + isSupportTheme: true, + describe: 'key宽度最多92,value是左对齐的', + onPressed: () { + Navigator.push(context, MaterialPageRoute( + builder: (BuildContext context) { + return TextContentExample(); + }, + )); }, - )); - }, - ), - ListItem( - title: "两列纯文本", - isShowLine: false, - isSupportTheme: true, - describe: '两组key-value展示', - onPressed: () { - Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) { - return BrnTextRIchContentExample(); + ), + ListItem( + title: "单列紧贴着key名", + isSupportTheme: true, + describe: 'Value紧贴着Key,Key和value都是一行展示', + onPressed: () { + Navigator.push(context, MaterialPageRoute( + builder: (BuildContext context) { + return KeyTextCloseContentExample(); + }, + )); }, - )); - }, - ), - ListItem( - title: "两列复杂元素", - isShowLine: false, - isSupportTheme: true, - describe: '元素中可以携带问号等', - onPressed: () { - Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) { - return BrnTwoRichContentExample(); + ), + ListItem( + title: "两列纯文本", + isShowLine: false, + isSupportTheme: true, + describe: '两组key-value展示', + onPressed: () { + Navigator.push(context, MaterialPageRoute( + builder: (BuildContext context) { + return BrnTextRIchContentExample(); + }, + )); }, - )); - }, - ), - ListItem( - title: "强化数字信息", - isShowLine: false, - isSupportTheme: true, - describe: '数字是大字体', - onPressed: () { - Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) { - return NumberItemRowExample(); + ), + ListItem( + title: "两列复杂元素", + isShowLine: false, + isSupportTheme: true, + describe: '元素中可以携带问号等', + onPressed: () { + Navigator.push(context, MaterialPageRoute( + builder: (BuildContext context) { + return BrnTwoRichContentExample(); + }, + )); }, - )); - }, - ), - ListItem( - title: "纯文本展示可收起", - isShowLine: false, - isSupportTheme: true, - describe: '展开收起文本', - onPressed: () { - Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) { - return BrnTextExpandedContentExample(); + ), + ListItem( + title: "强化数字信息", + isShowLine: false, + isSupportTheme: true, + describe: '数字是大字体', + onPressed: () { + Navigator.push(context, MaterialPageRoute( + builder: (BuildContext context) { + return NumberItemRowExample(); + }, + )); }, - )); - }, - ), - ListItem( - title: "文本+跳转操作", - isShowLine: false, - describe: 'value带有跳转箭头', - onPressed: () { - Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) { - return TextValueArrowContentExample(); + ), + ListItem( + title: "纯文本展示可收起", + isShowLine: false, + isSupportTheme: true, + describe: '展开收起文本', + onPressed: () { + Navigator.push(context, MaterialPageRoute( + builder: (BuildContext context) { + return BrnTextExpandedContentExample(); + }, + )); }, - )); - }, + ), + ListItem( + title: "文本+跳转操作", + isShowLine: false, + describe: 'value带有跳转箭头', + onPressed: () { + Navigator.push(context, MaterialPageRoute( + builder: (BuildContext context) { + return TextValueArrowContentExample(); + }, + )); + }, + ), + ], ), - - ],),); + ); } } diff --git a/example/lib/sample/components/card/content/text_value_arrow_example.dart b/example/lib/sample/components/card/content/text_value_arrow_example.dart index e902465a..143ad29e 100644 --- a/example/lib/sample/components/card/content/text_value_arrow_example.dart +++ b/example/lib/sample/components/card/content/text_value_arrow_example.dart @@ -1,14 +1,14 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; class TextValueArrowContentExample extends StatefulWidget { @override - _TextValueArrowContentExampleState createState() => _TextValueArrowContentExampleState(); + _TextValueArrowContentExampleState createState() => + _TextValueArrowContentExampleState(); } -class _TextValueArrowContentExampleState extends State { +class _TextValueArrowContentExampleState + extends State { @override Widget build(BuildContext context) { return Scaffold( @@ -23,7 +23,10 @@ class _TextValueArrowContentExampleState extends State[ Text( '规则', - style: TextStyle(color: Color(0xFF222222), fontSize: 28, fontWeight: FontWeight.bold), + style: TextStyle( + color: Color(0xFF222222), + fontSize: 28, + fontWeight: FontWeight.bold), ), BrnBubbleText( maxLines: 4, @@ -147,7 +150,8 @@ class _TextValueArrowContentExampleState extends State { children: [ Text( '规则', - style: TextStyle(color: Color(0xFF222222), fontSize: 28, fontWeight: FontWeight.bold), + style: TextStyle( + color: Color(0xFF222222), + fontSize: 28, + fontWeight: FontWeight.bold), ), BrnBubbleText( maxLines: 4, diff --git a/example/lib/sample/components/card_title/brn_common_title_example.dart b/example/lib/sample/components/card_title/brn_common_title_example.dart index fd5bd176..060b2f09 100644 --- a/example/lib/sample/components/card_title/brn_common_title_example.dart +++ b/example/lib/sample/components/card_title/brn_common_title_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/card_title/title_example.dart b/example/lib/sample/components/card_title/title_example.dart index 084cce7a..66b73224 100644 --- a/example/lib/sample/components/card_title/title_example.dart +++ b/example/lib/sample/components/card_title/title_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:example/sample/components/card_title/brn_action_title_example.dart'; import 'package:example/sample/components/card_title/brn_common_title_example.dart'; diff --git a/example/lib/sample/components/charts/chart_entry_example.dart b/example/lib/sample/components/charts/chart_entry_example.dart index 64dd6ea0..7afea5dc 100644 --- a/example/lib/sample/components/charts/chart_entry_example.dart +++ b/example/lib/sample/components/charts/chart_entry_example.dart @@ -1,5 +1,3 @@ - - import 'dart:math'; import 'package:bruno/bruno.dart'; @@ -414,7 +412,8 @@ class RadarChartExample extends StatefulWidget { } } -class _RadarChartExampleState extends State with SingleTickerProviderStateMixin { +class _RadarChartExampleState extends State + with SingleTickerProviderStateMixin { late double radius; int? sideCount; double? angle; @@ -445,7 +444,8 @@ class _RadarChartExampleState extends State with SingleTicker dataList1[i.toString()] = data1; dataList2[i.toString()] = data2; } - controller = new AnimationController(duration: const Duration(milliseconds: 300), vsync: this); + controller = new AnimationController( + duration: const Duration(milliseconds: 300), vsync: this); animation = new CurvedAnimation(parent: controller, curve: Curves.ease); animation = new Tween(begin: 0.0, end: 1.0).animate(animation); controller.forward(); @@ -464,8 +464,17 @@ class _RadarChartExampleState extends State with SingleTicker sidesCount: 5, markerMargin: padding, rotateAngle: angle! * 2 * pi / 360, - data: [dataList1[sideCount.toString()]!, dataList2[sideCount.toString()]!], - tagNames: ['合作共赢诚实守信', '合作共赢诚实守信', '合作共赢诚实守信', '合作共赢诚实守信', '合作共赢诚实守信'], + data: [ + dataList1[sideCount.toString()]!, + dataList2[sideCount.toString()]! + ], + tagNames: [ + '合作共赢诚实守信', + '合作共赢诚实守信', + '合作共赢诚实守信', + '合作共赢诚实守信', + '合作共赢诚实守信' + ], ); } else { return BrnRadarChart( diff --git a/example/lib/sample/components/charts/doughnut_chart_example.dart b/example/lib/sample/components/charts/doughnut_chart_example.dart index b653326a..6b67a20b 100644 --- a/example/lib/sample/components/charts/doughnut_chart_example.dart +++ b/example/lib/sample/components/charts/doughnut_chart_example.dart @@ -1,5 +1,3 @@ - - import 'dart:math'; import 'package:bruno/bruno.dart'; @@ -29,7 +27,9 @@ class DoughnutChartExampleState extends State { super.initState(); for (int i = 0; i < count; i++) { dataList.add(BrnDoughnutDataItem( - title: '示例', value: random(1, 5).toDouble(), color: getColorWithIndex(i))); + title: '示例', + value: random(1, 5).toDouble(), + color: getColorWithIndex(i))); } } @@ -63,7 +63,9 @@ class DoughnutChartExampleState extends State { }); }, ), - DoughnutChartLegend(data: this.dataList, legendStyle: BrnDoughnutChartLegendStyle.wrap), + DoughnutChartLegend( + data: this.dataList, + legendStyle: BrnDoughnutChartLegendStyle.wrap), Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ diff --git a/example/lib/sample/components/charts/line/brn_broken_line_example.dart b/example/lib/sample/components/charts/line/brn_broken_line_example.dart index 0d6b119b..cbb7929f 100644 --- a/example/lib/sample/components/charts/line/brn_broken_line_example.dart +++ b/example/lib/sample/components/charts/line/brn_broken_line_example.dart @@ -1,5 +1,3 @@ - - import 'dart:math'; import 'package:bruno/bruno.dart'; @@ -72,7 +70,10 @@ class _BrokenLineExampleState extends State { isShowPoint: true, isCurve: true, points: _linePointsForExample1(brokenData), - shaderColors: [Colors.green.withOpacity(0.3), Colors.green.withOpacity(0.01)], + shaderColors: [ + Colors.green.withOpacity(0.3), + Colors.green.withOpacity(0.01) + ], lineColor: Colors.green, ) ], @@ -101,7 +102,6 @@ class _BrokenLineExampleState extends State { x: brokenData.indexOf(_).toDouble(), y: double.parse(_.value!), lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return _.value; @@ -109,7 +109,8 @@ class _BrokenLineExampleState extends State { .toList(); } - List _getYDialValuesForExample1(List brokenData) { + List _getYDialValuesForExample1( + List brokenData) { double min = _getMinValueForExample1(brokenData); double max = _getMaxValueForExample1(brokenData); double dValue = (max - min) / 10; @@ -145,7 +146,8 @@ class _BrokenLineExampleState extends State { return maxValue; } - List _getXDialValuesForExample1(List brokenData) { + List _getXDialValuesForExample1( + List brokenData) { List _xDialValue = []; for (int index = 0; index < brokenData.length; index++) { _xDialValue.add(BrnDialItem( @@ -205,7 +207,6 @@ class _BrokenLineExampleState extends State { x: 1, y: 15, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '15'; @@ -215,7 +216,6 @@ class _BrokenLineExampleState extends State { y: 30, pointText: '22222', lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '30'; @@ -225,7 +225,6 @@ class _BrokenLineExampleState extends State { x: 3, y: 17, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '17'; @@ -235,7 +234,6 @@ class _BrokenLineExampleState extends State { x: 4, y: 45, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '45'; @@ -245,13 +243,15 @@ class _BrokenLineExampleState extends State { x: 5, y: 80, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '80'; })), ], - shaderColors: [Colors.blue.withOpacity(0.3), Colors.blue.withOpacity(0.01)], + shaderColors: [ + Colors.blue.withOpacity(0.3), + Colors.blue.withOpacity(0.01) + ], lineColor: Colors.blue, ); _pointsLine1 = BrnPointsLine( @@ -267,7 +267,6 @@ class _BrokenLineExampleState extends State { x: 2.5, y: 4, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '30'; @@ -277,7 +276,6 @@ class _BrokenLineExampleState extends State { x: 3, y: 20, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '17'; @@ -287,7 +285,6 @@ class _BrokenLineExampleState extends State { x: 4, y: 30, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '45'; @@ -297,7 +294,6 @@ class _BrokenLineExampleState extends State { x: 5, y: 50, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '80'; @@ -307,13 +303,15 @@ class _BrokenLineExampleState extends State { x: 6, y: 5, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '80'; })), ], - shaderColors: [Colors.green.withOpacity(0.3), Colors.green.withOpacity(0.01)], + shaderColors: [ + Colors.green.withOpacity(0.3), + Colors.green.withOpacity(0.01) + ], lineColor: Colors.green, ); @@ -434,7 +432,6 @@ class _BrokenLineExampleState extends State { y: 30, x: 1, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return Container( @@ -465,16 +462,18 @@ class _BrokenLineExampleState extends State { y: 80, x: 2, lineTouchData: BrnLineTouchData( - onTouch: () { return Container( - padding: EdgeInsets.only(left: 10, right: 10, top: 8, bottom: 8), + padding: + EdgeInsets.only(left: 10, right: 10, top: 8, bottom: 8), child: Center( child: Text( - 'content', - style: - TextStyle(fontSize: 12, fontWeight: FontWeight.w500, color: Colors.white), - )), + 'content', + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w500, + color: Colors.white), + )), decoration: BoxDecoration( color: Colors.black.withOpacity(0.8), borderRadius: BorderRadius.circular(2.0), @@ -487,7 +486,8 @@ class _BrokenLineExampleState extends State { ], ), ); - }, tipWindowSize:Size(60, 40) )), + }, + tipWindowSize: Size(60, 40))), BrnPointData( pointText: '20', y: 20, @@ -502,7 +502,7 @@ class _BrokenLineExampleState extends State { y: 67, x: 4, lineTouchData: BrnLineTouchData( - tipWindowSize:Size(60, 40), + tipWindowSize: Size(60, 40), onTouch: () { return '66'; })), @@ -511,7 +511,6 @@ class _BrokenLineExampleState extends State { y: 10, x: 5, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '10'; @@ -521,7 +520,6 @@ class _BrokenLineExampleState extends State { y: 40, x: 6, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '40'; @@ -531,7 +529,6 @@ class _BrokenLineExampleState extends State { y: 60, x: 7, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '100'; @@ -541,7 +538,6 @@ class _BrokenLineExampleState extends State { y: 70, x: 8, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '100'; @@ -551,7 +547,6 @@ class _BrokenLineExampleState extends State { y: 90, x: 9, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '100'; @@ -561,7 +556,6 @@ class _BrokenLineExampleState extends State { y: 80, x: 10, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '11'; @@ -571,7 +565,6 @@ class _BrokenLineExampleState extends State { y: 100, x: 11, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '100'; @@ -592,7 +585,6 @@ class _BrokenLineExampleState extends State { y: 15, x: 1, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '15'; @@ -602,7 +594,6 @@ class _BrokenLineExampleState extends State { y: 30, x: 2, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '30'; @@ -612,7 +603,6 @@ class _BrokenLineExampleState extends State { y: 17, x: 3, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '17'; @@ -622,7 +612,6 @@ class _BrokenLineExampleState extends State { y: 25, x: 4, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '18'; @@ -632,7 +621,6 @@ class _BrokenLineExampleState extends State { y: 40, x: 5, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '13'; @@ -642,7 +630,6 @@ class _BrokenLineExampleState extends State { y: 30, x: 6, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '16'; @@ -652,7 +639,6 @@ class _BrokenLineExampleState extends State { y: 49, x: 7, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '49'; @@ -671,7 +657,6 @@ class _BrokenLineExampleState extends State { y: 80, x: 9, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '77'; @@ -681,7 +666,6 @@ class _BrokenLineExampleState extends State { y: 90, x: 10, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '88'; @@ -691,13 +675,15 @@ class _BrokenLineExampleState extends State { y: 60, x: 11, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '99'; })), ], - shaderColors: [Colors.green.withOpacity(0.3), Colors.green.withOpacity(0.01)], + shaderColors: [ + Colors.green.withOpacity(0.3), + Colors.green.withOpacity(0.01) + ], lineColor: Colors.green, ); @@ -804,7 +790,6 @@ class _BrokenLineExampleState extends State { y: 30, x: 1, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return Container( @@ -838,12 +823,15 @@ class _BrokenLineExampleState extends State { tipWindowSize: Size(60, 40), onTouch: () { return Container( - padding: EdgeInsets.only(left: 10, right: 10, top: 8, bottom: 8), + padding: + EdgeInsets.only(left: 10, right: 10, top: 8, bottom: 8), child: Center( child: Text( 'content', - style: - TextStyle(fontSize: 12, fontWeight: FontWeight.w500, color: Colors.white), + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w500, + color: Colors.white), )), decoration: BoxDecoration( color: Colors.black.withOpacity(0.8), @@ -881,7 +869,6 @@ class _BrokenLineExampleState extends State { y: 10, x: 5, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '10'; @@ -891,7 +878,6 @@ class _BrokenLineExampleState extends State { y: 40, x: 6, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '40'; @@ -901,7 +887,6 @@ class _BrokenLineExampleState extends State { y: 60, x: 7, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '100'; @@ -911,7 +896,6 @@ class _BrokenLineExampleState extends State { y: 70, x: 8, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '100'; @@ -921,7 +905,6 @@ class _BrokenLineExampleState extends State { y: 90, x: 9, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '100'; @@ -931,7 +914,6 @@ class _BrokenLineExampleState extends State { y: 80, x: 10, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '11'; @@ -941,7 +923,6 @@ class _BrokenLineExampleState extends State { y: 100, x: 11, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '100'; @@ -962,7 +943,6 @@ class _BrokenLineExampleState extends State { y: 15, x: 1, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '15'; @@ -972,7 +952,6 @@ class _BrokenLineExampleState extends State { y: 30, x: 2, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '30'; @@ -982,7 +961,6 @@ class _BrokenLineExampleState extends State { y: 17, x: 3, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '17'; @@ -992,7 +970,6 @@ class _BrokenLineExampleState extends State { y: 25, x: 4, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '18'; @@ -1002,7 +979,6 @@ class _BrokenLineExampleState extends State { y: 40, x: 5, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '13'; @@ -1012,7 +988,6 @@ class _BrokenLineExampleState extends State { y: 30, x: 6, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '16'; @@ -1022,7 +997,6 @@ class _BrokenLineExampleState extends State { y: 49, x: 7, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '49'; @@ -1041,7 +1015,6 @@ class _BrokenLineExampleState extends State { y: 80, x: 9, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '77'; @@ -1051,7 +1024,6 @@ class _BrokenLineExampleState extends State { y: 90, x: 10, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '88'; @@ -1061,13 +1033,15 @@ class _BrokenLineExampleState extends State { y: 60, x: 11, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '99'; })), ], - shaderColors: [Colors.green.withOpacity(0.3), Colors.green.withOpacity(0.01)], + shaderColors: [ + Colors.green.withOpacity(0.3), + Colors.green.withOpacity(0.01) + ], lineColor: Colors.green, ); @@ -1123,14 +1097,15 @@ class _BrokenLineExampleState extends State { var chartLine = BrnBrokenLine( contentPadding: EdgeInsets.only(left: 20, right: 10), lines: _getPointsLineListWithShowPointText(), - size: Size( - MediaQuery.of(context).size.width, MediaQuery.of(context).size.height / 5 * 1.6 - 20 * 2), + size: Size(MediaQuery.of(context).size.width, + MediaQuery.of(context).size.height / 5 * 1.6 - 20 * 2), isShowXHintLine: true, yHintLineOffset: 30, yDialValues: _yDialValuesForExample5(), yDialMin: 0, yDialMax: 120, - xDialValues: _getXDialValuesForExample5(_getPointsLineListWithShowPointText()), + xDialValues: + _getXDialValuesForExample5(_getPointsLineListWithShowPointText()), xDialMin: 1, xDialMax: 11, isHintLineSolid: false, @@ -1209,12 +1184,11 @@ class _BrokenLineExampleState extends State { points: [ BrnPointData( pointText: '9999.99', - pointTextStyle: - TextStyle(fontWeight: FontWeight.w600, fontSize: 12, color: Colors.red), + pointTextStyle: TextStyle( + fontWeight: FontWeight.w600, fontSize: 12, color: Colors.red), y: 80, x: 1, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return Container( @@ -1243,20 +1217,23 @@ class _BrokenLineExampleState extends State { BrnPointData( offset: Offset(0, -5), pointText: '9999.99', - pointTextStyle: - TextStyle(fontWeight: FontWeight.w600, fontSize: 12, color: Colors.red), + pointTextStyle: TextStyle( + fontWeight: FontWeight.w600, fontSize: 12, color: Colors.red), y: 80, x: 2, lineTouchData: BrnLineTouchData( tipWindowSize: Size(60, 40), onTouch: () { return Container( - padding: EdgeInsets.only(left: 10, right: 10, top: 8, bottom: 8), + padding: + EdgeInsets.only(left: 10, right: 10, top: 8, bottom: 8), child: Center( child: Text( 'content', - style: - TextStyle(fontSize: 12, fontWeight: FontWeight.w500, color: Colors.white), + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w500, + color: Colors.white), )), decoration: BoxDecoration( color: Colors.black.withOpacity(0.8), @@ -1276,7 +1253,6 @@ class _BrokenLineExampleState extends State { y: 20, x: 3, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '20'; @@ -1295,7 +1271,6 @@ class _BrokenLineExampleState extends State { y: 10, x: 5, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '10'; @@ -1305,7 +1280,6 @@ class _BrokenLineExampleState extends State { y: 40, x: 6, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '40'; @@ -1315,7 +1289,6 @@ class _BrokenLineExampleState extends State { y: 60, x: 7, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '100'; @@ -1325,7 +1298,6 @@ class _BrokenLineExampleState extends State { y: 70, x: 8, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '100'; @@ -1335,7 +1307,6 @@ class _BrokenLineExampleState extends State { y: 90, x: 9, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '100'; @@ -1345,7 +1316,6 @@ class _BrokenLineExampleState extends State { y: 80, x: 10, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '11'; @@ -1355,7 +1325,6 @@ class _BrokenLineExampleState extends State { y: 100, x: 11, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '100'; @@ -1375,7 +1344,6 @@ class _BrokenLineExampleState extends State { y: 15, x: 1, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '15'; @@ -1385,7 +1353,6 @@ class _BrokenLineExampleState extends State { y: 30, x: 2, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '30'; @@ -1395,7 +1362,6 @@ class _BrokenLineExampleState extends State { y: 17, x: 3, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '17'; @@ -1405,7 +1371,6 @@ class _BrokenLineExampleState extends State { y: 25, x: 4, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '18'; @@ -1415,7 +1380,6 @@ class _BrokenLineExampleState extends State { y: 40, x: 5, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '13'; @@ -1425,7 +1389,6 @@ class _BrokenLineExampleState extends State { y: 30, x: 6, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '16'; @@ -1435,7 +1398,6 @@ class _BrokenLineExampleState extends State { y: 49, x: 7, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '49'; @@ -1445,7 +1407,6 @@ class _BrokenLineExampleState extends State { y: 66, x: 8, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '66'; @@ -1455,7 +1416,6 @@ class _BrokenLineExampleState extends State { y: 80, x: 9, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '77'; @@ -1465,7 +1425,6 @@ class _BrokenLineExampleState extends State { y: 90, x: 10, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '88'; @@ -1475,13 +1434,15 @@ class _BrokenLineExampleState extends State { y: 60, x: 11, lineTouchData: BrnLineTouchData( - tipWindowSize: Size(60, 40), onTouch: () { return '99'; })), ], - shaderColors: [Colors.green.withOpacity(0.3), Colors.green.withOpacity(0.01)], + shaderColors: [ + Colors.green.withOpacity(0.3), + Colors.green.withOpacity(0.01) + ], lineColor: Colors.green, ); @@ -1498,7 +1459,8 @@ class _BrokenLineExampleState extends State { height: 3, width: 12, decoration: BoxDecoration( - color: bean.lineColor, borderRadius: BorderRadius.all(Radius.circular(1.5))), + color: bean.lineColor, + borderRadius: BorderRadius.all(Radius.circular(1.5))), ), Text('图例', style: TextStyle(fontSize: 12, color: Color(0xFF999999))), SizedBox(width: 6), @@ -1509,7 +1471,8 @@ class _BrokenLineExampleState extends State { return Column(mainAxisSize: MainAxisSize.max, children: [ Container( alignment: Alignment.centerLeft, - child: Text('图表标题', style: TextStyle(fontSize: 18, color: Colors.black))), + child: Text('图表标题', + style: TextStyle(fontSize: 18, color: Colors.black))), Row(children: widgetList), ]); } diff --git a/example/lib/sample/components/charts/line/db_data_node_model.dart b/example/lib/sample/components/charts/line/db_data_node_model.dart index fc5928b8..cc84cf5b 100644 --- a/example/lib/sample/components/charts/line/db_data_node_model.dart +++ b/example/lib/sample/components/charts/line/db_data_node_model.dart @@ -1,7 +1,5 @@ /// @desc 看板卡片中用于描述数据指标的模型,也能用于数据块的定义,内部嵌套了一个itemList - - class DBDataNodeModel { String? key; String? name; @@ -26,6 +24,7 @@ class DBDataNodeModel { /// section data field String? url; DBDataNodeModel? total; + DBDataNodeModel(); factory DBDataNodeModel.fromJson(Map? json) { diff --git a/example/lib/sample/components/charts/progress_bar_chart_example.dart b/example/lib/sample/components/charts/progress_bar_chart_example.dart index b0563676..7f987101 100644 --- a/example/lib/sample/components/charts/progress_bar_chart_example.dart +++ b/example/lib/sample/components/charts/progress_bar_chart_example.dart @@ -1,5 +1,3 @@ - - import 'dart:math'; import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -34,7 +32,10 @@ class ProgressBarChartExampleState extends State { AxisItem(showText: '20'), AxisItem(showText: '30') ]), - yAxis: ChartAxis(axisItemList: [AxisItem(showText: '示例1'), AxisItem(showText: '示例2')]), + yAxis: ChartAxis(axisItemList: [ + AxisItem(showText: '示例1'), + AxisItem(showText: '示例2') + ]), singleBarWidth: 30, barBundleList: [ BrnProgressBarBundle(barList: [ @@ -63,12 +64,17 @@ class ProgressBarChartExampleState extends State { barBundleList: [ BrnProgressBarBundle(barList: [ BrnProgressBarItem( - text: '示例11', value: 5, hintValue: 15, showBarValueText: "1122334"), - BrnProgressBarItem(text: '示例12', value: 20, selectedHintText: '示例12:20'), + text: '示例11', + value: 5, + hintValue: 15, + showBarValueText: "1122334"), + BrnProgressBarItem( + text: '示例12', value: 20, selectedHintText: '示例12:20'), BrnProgressBarItem( text: '示例13', value: 30, - selectedHintText: '示例13:30\n示例13:30\n示例13:30\n示例13:30\n示例13:30\n示例13:30'), + selectedHintText: + '示例13:30\n示例13:30\n示例13:30\n示例13:30\n示例13:30\n示例13:30'), BrnProgressBarItem(text: '示例14', value: 25), BrnProgressBarItem(text: '示例15', value: 21), BrnProgressBarItem(text: '示例16', value: 28), @@ -82,11 +88,13 @@ class ProgressBarChartExampleState extends State { ]), BrnProgressBarBundle(barList: [ BrnProgressBarItem(text: '示例21', value: 20, hintValue: 15), - BrnProgressBarItem(text: '示例22', value: 15, selectedHintText: '示例12:20'), + BrnProgressBarItem( + text: '示例22', value: 15, selectedHintText: '示例12:20'), BrnProgressBarItem( text: '示例23', value: 30, - selectedHintText: '示例13:30\n示例13:30\n示例13:30\n示例13:30\n示例13:30\n示例13:30'), + selectedHintText: + '示例13:30\n示例13:30\n示例13:30\n示例13:30\n示例13:30\n示例13:30'), BrnProgressBarItem(text: '示例24', value: 20), BrnProgressBarItem(text: '示例25', value: 28), BrnProgressBarItem(text: '示例26', value: 25), @@ -107,7 +115,8 @@ class ProgressBarChartExampleState extends State { singleBarWidth: 30, barGroupSpace: 30, barMaxValue: 60, - onBarItemClickInterceptor: (barBundleIndex, barBundle, barGroupIndex, barItem) { + onBarItemClickInterceptor: + (barBundleIndex, barBundle, barGroupIndex, barItem) { return true; }, ) diff --git a/example/lib/sample/components/charts/progress_chart_entry_page.dart b/example/lib/sample/components/charts/progress_chart_entry_page.dart index 6d71c9dc..bb0b34c9 100644 --- a/example/lib/sample/components/charts/progress_chart_entry_page.dart +++ b/example/lib/sample/components/charts/progress_chart_entry_page.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/dialog/dialog_entry_page.dart b/example/lib/sample/components/dialog/dialog_entry_page.dart index f53999bf..2d36dac3 100644 --- a/example/lib/sample/components/dialog/dialog_entry_page.dart +++ b/example/lib/sample/components/dialog/dialog_entry_page.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:example/sample/home/list_item.dart'; import 'package:flutter/material.dart'; @@ -336,7 +334,7 @@ class DialogEntryPage extends StatelessWidget { ///多选弹框 void _showMiddleMultiSelectDialog(BuildContext context) { - List data = []; + List data = []; data.add(new MultiSelectItem("100", "感兴趣待跟进")); data.add(new MultiSelectItem("101", "感兴趣但对本商圈没兴趣", isChecked: true)); data.add(new MultiSelectItem("102", "接通后挂断/不感兴趣", isChecked: true)); @@ -363,7 +361,7 @@ class DialogEntryPage extends StatelessWidget { void _showMiddleMultiSelectWithMessageWidgetDialog(BuildContext context) { String hintText = "感兴趣待跟进"; - List data = []; + List data = []; data.add(new MultiSelectItem("100", "感兴趣待跟进")); data.add(new MultiSelectItem("101", "感兴趣但对本商圈没兴趣", isChecked: true)); data.add(new MultiSelectItem("102", "接通后挂断/不感兴趣", isChecked: true)); @@ -432,7 +430,7 @@ class DialogEntryPage extends StatelessWidget { ///多选弹框 void _showMiddleMultiSelectWithMessageDialog(BuildContext context) { - List data = []; + List data = []; data.add(new MultiSelectItem("100", "感兴趣待跟进")); data.add(new MultiSelectItem("101", "感兴趣但对本商圈没兴趣", isChecked: true)); data.add(new MultiSelectItem("102", "接通后挂断/不感兴趣", isChecked: true)); diff --git a/example/lib/sample/components/empty/abnormal_entry_page.dart b/example/lib/sample/components/empty/abnormal_entry_page.dart index 3cfddc66..a0fa3ffa 100644 --- a/example/lib/sample/components/empty/abnormal_entry_page.dart +++ b/example/lib/sample/components/empty/abnormal_entry_page.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:example/sample/components/empty/abnormal_state_example.dart'; import 'package:example/sample/home/list_item.dart'; diff --git a/example/lib/sample/components/empty/abnormal_state_example.dart b/example/lib/sample/components/empty/abnormal_state_example.dart index 9ec98bd5..c1c209f8 100644 --- a/example/lib/sample/components/empty/abnormal_state_example.dart +++ b/example/lib/sample/components/empty/abnormal_state_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/form/all_item_style_example.dart b/example/lib/sample/components/form/all_item_style_example.dart index 6084e42f..f5df6702 100644 --- a/example/lib/sample/components/form/all_item_style_example.dart +++ b/example/lib/sample/components/form/all_item_style_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:example/sample/components/form/group_example/expansion_group_example.dart'; import 'package:example/sample/components/form/group_example/group_add_example.dart'; @@ -221,7 +219,7 @@ class AllFormItemStyleExamplePage extends StatelessWidget { )); }, ), - ListItem( + ListItem( title: "全选表单项", describe: "杂项类型", isSupportTheme: true, diff --git a/example/lib/sample/components/form/group_example/expansion_group_example.dart b/example/lib/sample/components/form/group_example/expansion_group_example.dart index 9d2f2d98..248937bb 100644 --- a/example/lib/sample/components/form/group_example/expansion_group_example.dart +++ b/example/lib/sample/components/form/group_example/expansion_group_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/form/group_example/group_add_example.dart b/example/lib/sample/components/form/group_example/group_add_example.dart index 2e810ecf..7516c930 100644 --- a/example/lib/sample/components/form/group_example/group_add_example.dart +++ b/example/lib/sample/components/form/group_example/group_add_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/form/group_example/normal_group_example.dart b/example/lib/sample/components/form/group_example/normal_group_example.dart index 5b4b133a..8edefddd 100644 --- a/example/lib/sample/components/form/group_example/normal_group_example.dart +++ b/example/lib/sample/components/form/group_example/normal_group_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/form/items_example/base_title_example.dart b/example/lib/sample/components/form/items_example/base_title_example.dart index b2e8b9d7..2686d863 100644 --- a/example/lib/sample/components/form/items_example/base_title_example.dart +++ b/example/lib/sample/components/form/items_example/base_title_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -50,10 +48,10 @@ class BaseTitleExamplePage extends StatelessWidget { tipLabel: "提示", isRequire: true, customActionWidget: Container( - color:Colors.lightBlue, + color: Colors.lightBlue, child: Center( - child: Text('我是自定义视图', style: TextStyle(color: Colors.white)) - ), + child: + Text('我是自定义视图', style: TextStyle(color: Colors.white))), ), onTip: () { BrnToast.show("点击触发回调_onTip", context); diff --git a/example/lib/sample/components/form/items_example/multi_choice_example.dart b/example/lib/sample/components/form/items_example/multi_choice_example.dart index 204e8f4b..a9b6e64f 100644 --- a/example/lib/sample/components/form/items_example/multi_choice_example.dart +++ b/example/lib/sample/components/form/items_example/multi_choice_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -44,7 +42,8 @@ class MultiChoiceInputExamplePage extends StatelessWidget { }, onChanged: (List oldValue, List? newValue) { BrnToast.show( - "点击触发onChanged回调${oldValue.length}_${newValue!.length}_onChanged", context); + "点击触发onChanged回调${oldValue.length}_${newValue!.length}_onChanged", + context); }, ), Container( @@ -83,7 +82,8 @@ class MultiChoiceInputExamplePage extends StatelessWidget { }, onChanged: (List oldValue, List? newValue) { BrnToast.show( - "点击触发onChanged回调${oldValue.length}_${newValue!.length}_onChanged", context); + "点击触发onChanged回调${oldValue.length}_${newValue!.length}_onChanged", + context); }, ), Container( @@ -121,7 +121,8 @@ class MultiChoiceInputExamplePage extends StatelessWidget { }, onChanged: (List oldValue, List newValue) { BrnToast.show( - "点击触发onChanged回调${oldValue.length}_${newValue.length}_onChanged", context); + "点击触发onChanged回调${oldValue.length}_${newValue.length}_onChanged", + context); }, ), ], diff --git a/example/lib/sample/components/form/items_example/multi_choice_protrait_example.dart b/example/lib/sample/components/form/items_example/multi_choice_protrait_example.dart index e74e91aa..1935a264 100644 --- a/example/lib/sample/components/form/items_example/multi_choice_protrait_example.dart +++ b/example/lib/sample/components/form/items_example/multi_choice_protrait_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -48,7 +46,8 @@ class MultiChoicePortraitInputExamplePage extends StatelessWidget { }, onChanged: (List oldValue, List newValue) { BrnToast.show( - "点击触发onChanged回调${oldValue.length}_${newValue.length}_onChanged", context); + "点击触发onChanged回调${oldValue.length}_${newValue.length}_onChanged", + context); }, ), Container( @@ -89,7 +88,8 @@ class MultiChoicePortraitInputExamplePage extends StatelessWidget { }, onChanged: (List oldValue, List newValue) { BrnToast.show( - "点击触发onChanged回调${oldValue.length}_${newValue.length}_onChanged", context); + "点击触发onChanged回调${oldValue.length}_${newValue.length}_onChanged", + context); }, ), Container( @@ -129,7 +129,8 @@ class MultiChoicePortraitInputExamplePage extends StatelessWidget { }, onChanged: (List oldValue, List newValue) { BrnToast.show( - "点击触发onChanged回调${oldValue.length}_${newValue.length}_onChanged", context); + "点击触发onChanged回调${oldValue.length}_${newValue.length}_onChanged", + context); }, ), ], diff --git a/example/lib/sample/components/form/items_example/radio_input_example.dart b/example/lib/sample/components/form/items_example/radio_input_example.dart index f05edb6e..f4393c5f 100644 --- a/example/lib/sample/components/form/items_example/radio_input_example.dart +++ b/example/lib/sample/components/form/items_example/radio_input_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -43,7 +41,8 @@ class RadioInputExamplePage extends StatelessWidget { BrnToast.show("点击触发onRemoveTap回调", context); }, onChanged: (oldValue, newValue) { - BrnToast.show("点击触发回调${oldValue}_${newValue}_onChanged", context); + BrnToast.show( + "点击触发回调${oldValue}_${newValue}_onChanged", context); }, ), Container( @@ -78,7 +77,8 @@ class RadioInputExamplePage extends StatelessWidget { BrnToast.show("点击触发onRemoveTap回调", context); }, onChanged: (oldValue, newValue) { - BrnToast.show("点击触发回调${oldValue}_${newValue}_onChanged", context); + BrnToast.show( + "点击触发回调${oldValue}_${newValue}_onChanged", context); }, ), Container( @@ -112,7 +112,8 @@ class RadioInputExamplePage extends StatelessWidget { BrnToast.show("点击触发onRemoveTap回调", context); }, onChanged: (oldValue, newValue) { - BrnToast.show("点击触发回调${oldValue}_${newValue}_onChanged", context); + BrnToast.show( + "点击触发回调${oldValue}_${newValue}_onChanged", context); }, ), Container( diff --git a/example/lib/sample/components/form/items_example/radio_protrait_example.dart b/example/lib/sample/components/form/items_example/radio_protrait_example.dart index b4c3949d..03cb1d39 100644 --- a/example/lib/sample/components/form/items_example/radio_protrait_example.dart +++ b/example/lib/sample/components/form/items_example/radio_protrait_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -44,7 +42,8 @@ class RadioPortraitInputExamplePage extends StatelessWidget { BrnToast.show("点击触发onRemoveTap回调", context); }, onChanged: (oldValue, newValue) { - BrnToast.show("点击触发回调${oldValue}_${newValue}_onChanged", context); + BrnToast.show( + "点击触发回调${oldValue}_${newValue}_onChanged", context); }, ), Container( @@ -81,7 +80,8 @@ class RadioPortraitInputExamplePage extends StatelessWidget { BrnToast.show("点击触发onRemoveTap回调", context); }, onChanged: (oldValue, newValue) { - BrnToast.show("点击触发回调${oldValue}_${newValue}_onChanged", context); + BrnToast.show( + "点击触发回调${oldValue}_${newValue}_onChanged", context); }, ), Container( @@ -117,7 +117,8 @@ class RadioPortraitInputExamplePage extends StatelessWidget { BrnToast.show("点击触发onRemoveTap回调", context); }, onChanged: (oldValue, newValue) { - BrnToast.show("点击触发回调${oldValue}_${newValue}_onChanged", context); + BrnToast.show( + "点击触发回调${oldValue}_${newValue}_onChanged", context); }, ), ], diff --git a/example/lib/sample/components/form/items_example/range_input_example.dart b/example/lib/sample/components/form/items_example/range_input_example.dart index 0e207851..e11a6e6b 100644 --- a/example/lib/sample/components/form/items_example/range_input_example.dart +++ b/example/lib/sample/components/form/items_example/range_input_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/form/items_example/ratio_input_example.dart b/example/lib/sample/components/form/items_example/ratio_input_example.dart index 5d374d59..d90e38f4 100644 --- a/example/lib/sample/components/form/items_example/ratio_input_example.dart +++ b/example/lib/sample/components/form/items_example/ratio_input_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/form/items_example/select_all_title_example.dart b/example/lib/sample/components/form/items_example/select_all_title_example.dart index 78507285..82003344 100644 --- a/example/lib/sample/components/form/items_example/select_all_title_example.dart +++ b/example/lib/sample/components/form/items_example/select_all_title_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -31,7 +29,7 @@ class SelectAllTitleExamplePage extends StatelessWidget { subTitle: "这里是副标题", selectText: '全选标题', selectState: false, - onSelectAll: (int index, bool isSelect){ + onSelectAll: (int index, bool isSelect) { BrnToast.show("全选回调_onSelectAll", context); }, onTip: () { @@ -56,12 +54,12 @@ class SelectAllTitleExamplePage extends StatelessWidget { tipLabel: "提示", isRequire: true, customActionWidget: Container( - color:Colors.lightBlue, + color: Colors.lightBlue, child: Center( - child: Text('我是自定义视图', style: TextStyle(color: Colors.white)) - ), + child: + Text('我是自定义视图', style: TextStyle(color: Colors.white))), ), - onSelectAll: (int index, bool isSelect){ + onSelectAll: (int index, bool isSelect) { BrnToast.show("全选回调_onSelectAll", context); }, onTip: () { diff --git a/example/lib/sample/components/form/items_example/star_example.dart b/example/lib/sample/components/form/items_example/star_example.dart index d9f2f43f..be97c7ce 100644 --- a/example/lib/sample/components/form/items_example/star_example.dart +++ b/example/lib/sample/components/form/items_example/star_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -40,7 +38,8 @@ class StarInputExamplePage extends StatelessWidget { BrnToast.show("点击触发onRemoveTap回调", context); }, onChanged: (oldValue, newValue) { - BrnToast.show("点击触发回调${oldValue}_${newValue}_onChanged", context); + BrnToast.show( + "点击触发回调${oldValue}_${newValue}_onChanged", context); }, ), Container( @@ -73,7 +72,8 @@ class StarInputExamplePage extends StatelessWidget { BrnToast.show("点击触发onRemoveTap回调", context); }, onChanged: (oldValue, newValue) { - BrnToast.show("点击触发回调${oldValue}_${newValue}_onChanged", context); + BrnToast.show( + "点击触发回调${oldValue}_${newValue}_onChanged", context); }, ), Container( @@ -105,7 +105,8 @@ class StarInputExamplePage extends StatelessWidget { BrnToast.show("点击触发onRemoveTap回调", context); }, onChanged: (oldValue, newValue) { - BrnToast.show("点击触发回调${oldValue}_${newValue}_onChanged", context); + BrnToast.show( + "点击触发回调${oldValue}_${newValue}_onChanged", context); }, ), ], diff --git a/example/lib/sample/components/form/items_example/step_input_example.dart b/example/lib/sample/components/form/items_example/step_input_example.dart index 07a92d2f..7ea9ce04 100644 --- a/example/lib/sample/components/form/items_example/step_input_example.dart +++ b/example/lib/sample/components/form/items_example/step_input_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -42,7 +40,8 @@ class StepInputExamplePage extends StatelessWidget { BrnToast.show("点击触发onRemoveTap回调", context); }, onChanged: (oldValue, newValue) { - BrnToast.show("点击触发回调${oldValue}_${newValue}_onChanged", context); + BrnToast.show( + "点击触发回调${oldValue}_${newValue}_onChanged", context); }, ), Container( @@ -75,7 +74,8 @@ class StepInputExamplePage extends StatelessWidget { BrnToast.show("点击触发onRemoveTap回调", context); }, onChanged: (oldValue, newValue) { - BrnToast.show("点击触发回调${oldValue}_${newValue}_onChanged", context); + BrnToast.show( + "点击触发回调${oldValue}_${newValue}_onChanged", context); }, ), Container( @@ -107,7 +107,8 @@ class StepInputExamplePage extends StatelessWidget { BrnToast.show("点击触发onRemoveTap回调", context); }, onChanged: (oldValue, newValue) { - BrnToast.show("点击触发回调${oldValue}_${newValue}_onChanged", context); + BrnToast.show( + "点击触发回调${oldValue}_${newValue}_onChanged", context); }, ), ], diff --git a/example/lib/sample/components/form/items_example/text_block_input_example.dart b/example/lib/sample/components/form/items_example/text_block_input_example.dart index 9d05ba9f..046d002a 100644 --- a/example/lib/sample/components/form/items_example/text_block_input_example.dart +++ b/example/lib/sample/components/form/items_example/text_block_input_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/form/items_example/text_input_example.dart b/example/lib/sample/components/form/items_example/text_input_example.dart index 2e3037d8..6c04ed6f 100644 --- a/example/lib/sample/components/form/items_example/text_input_example.dart +++ b/example/lib/sample/components/form/items_example/text_input_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/form/items_example/text_quick_select_input_example.dart b/example/lib/sample/components/form/items_example/text_quick_select_input_example.dart index 28698733..ade62644 100644 --- a/example/lib/sample/components/form/items_example/text_quick_select_input_example.dart +++ b/example/lib/sample/components/form/items_example/text_quick_select_input_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; @@ -63,11 +61,11 @@ class _TextQuickSelectInputExamplePageState if (status[index]) { selectedStr += '${options[index]} '; } else if (selectedStr.contains(options[index])) { - selectedStr = selectedStr.replaceFirst('${options[index]} ', ''); + selectedStr = + selectedStr.replaceFirst('${options[index]} ', ''); } BrnToast.show( - "点击触发onBtnSelectChanged回调。\n index:$index", - context); + "点击触发onBtnSelectChanged回调。\n index:$index", context); setState(() {}); }, onTip: () { @@ -105,15 +103,17 @@ class _TextQuickSelectInputExamplePageState subTitle: "这里是副标题", tipLabel: "标签", onBtnSelectChanged: (index) { - statusAllFunctionExample![index] = !statusAllFunctionExample![index]; + statusAllFunctionExample![index] = + !statusAllFunctionExample![index]; if (statusAllFunctionExample![index]) { selectedStrAllFunctionExample += '${options[index]} '; - } else if (selectedStrAllFunctionExample.contains(options[index])) { - selectedStrAllFunctionExample = selectedStrAllFunctionExample.replaceFirst('${options[index]} ', ''); + } else if (selectedStrAllFunctionExample + .contains(options[index])) { + selectedStrAllFunctionExample = selectedStrAllFunctionExample + .replaceFirst('${options[index]} ', ''); } BrnToast.show( - "点击触发onBtnSelectChanged回调。\n index:$index", - context); + "点击触发onBtnSelectChanged回调。\n index:$index", context); setState(() {}); }, onTip: () { diff --git a/example/lib/sample/components/form/items_example/text_select_example.dart b/example/lib/sample/components/form/items_example/text_select_example.dart index 7a689bbd..2f1ebfb3 100644 --- a/example/lib/sample/components/form/items_example/text_select_example.dart +++ b/example/lib/sample/components/form/items_example/text_select_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; diff --git a/example/lib/sample/components/form/items_example/title_example.dart b/example/lib/sample/components/form/items_example/title_example.dart index 8bcd8bb2..227cd61a 100644 --- a/example/lib/sample/components/form/items_example/title_example.dart +++ b/example/lib/sample/components/form/items_example/title_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/form/items_example/title_select_example.dart b/example/lib/sample/components/form/items_example/title_select_example.dart index afaff9d7..5af6a75a 100644 --- a/example/lib/sample/components/form/items_example/title_select_example.dart +++ b/example/lib/sample/components/form/items_example/title_select_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; diff --git a/example/lib/sample/components/gallery/gallery_detail_example.dart b/example/lib/sample/components/gallery/gallery_detail_example.dart index 1219679d..453bfb3c 100644 --- a/example/lib/sample/components/gallery/gallery_detail_example.dart +++ b/example/lib/sample/components/gallery/gallery_detail_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -9,7 +7,8 @@ class GalleryDetailExamplePage extends StatefulWidget { final String? title; final PhotoGalleryTheme photoGalleryTheme; - GalleryDetailExamplePage({this.title, this.photoGalleryTheme = PhotoGalleryTheme.dark}); + GalleryDetailExamplePage( + {this.title, this.photoGalleryTheme = PhotoGalleryTheme.dark}); @override State createState() { @@ -44,7 +43,8 @@ class GalleryDetailExamplePageState extends State { themeData: PhotoGalleryTheme.dark == widget.photoGalleryTheme ? BrnGalleryDetailConfig.dark() : BrnGalleryDetailConfig.light(), - url: "https://img1.baidu.com/it/u=2496571732,442429806&fm=26&fmt=auto&gp=0.jpg", + url: + "https://img1.baidu.com/it/u=2496571732,442429806&fm=26&fmt=auto&gp=0.jpg", showBottom: true, bottomCardModel: PhotoBottomCardState.cantFold, name: "一只猫", diff --git a/example/lib/sample/components/gallery/gallery_detail_page_theme_example.dart b/example/lib/sample/components/gallery/gallery_detail_page_theme_example.dart index 88ea69ac..9924ff3f 100644 --- a/example/lib/sample/components/gallery/gallery_detail_page_theme_example.dart +++ b/example/lib/sample/components/gallery/gallery_detail_page_theme_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:example/sample/components/gallery/gallery_detail_example.dart'; import 'package:example/sample/home/list_item.dart'; @@ -18,7 +16,7 @@ class GalleryDetailPageThemeExample extends StatelessWidget { ListItem( title: "图片详情-白色主题", describe: "图片详情带白色主题", - isShowLine:false, + isShowLine: false, onPressed: () { Navigator.push(context, MaterialPageRoute( builder: (BuildContext context) { diff --git a/example/lib/sample/components/gallery/gallery_example.dart b/example/lib/sample/components/gallery/gallery_example.dart index fe88e811..127387f4 100644 --- a/example/lib/sample/components/gallery/gallery_example.dart +++ b/example/lib/sample/components/gallery/gallery_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:example/sample/components/gallery/gallery_detail_page_theme_example.dart'; import 'package:example/sample/home/list_item.dart'; @@ -7,8 +5,6 @@ import 'package:flutter/material.dart'; // ignore: must_be_immutable class GalleryExample extends StatelessWidget { - - List allConfig = [ BrnPhotoGroupConfig.url(title: '第一项', urls: [ 'http://img1.mukewang.com/5c18cf540001ac8206000338.jpg', @@ -25,7 +21,7 @@ class GalleryExample extends StatelessWidget { bottomCardModel: PhotoBottomCardState.cantFold, name: "一只猫", des: - "图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述"), + "图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述"), BrnPhotoItemConfig( url: 'http://img1.mukewang.com/5c18cf540001ac8206000338.jpg', showBottom: true, @@ -38,13 +34,13 @@ class GalleryExample extends StatelessWidget { bottomCardModel: PhotoBottomCardState.unFold, name: "三只猫", des: - "图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述"), + "图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述"), BrnPhotoItemConfig( url: 'http://img1.mukewang.com/5c18cf540001ac8206000338.jpg', showBottom: false, name: "一张图片", des: - "图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述") + "图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述") ]), BrnPhotoGroupConfig.url(title: '第二项', urls: [ 'http://img1.mukewang.com/5c18cf540001ac8206000338.jpg', @@ -73,7 +69,7 @@ class GalleryExample extends StatelessWidget { bottomCardModel: PhotoBottomCardState.fold, name: "一张图片", des: - "图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述") + "图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述") ]), BrnPhotoGroupConfig(title: "带展示信息的模块", configList: [ BrnPhotoItemConfig( @@ -82,7 +78,7 @@ class GalleryExample extends StatelessWidget { bottomCardModel: PhotoBottomCardState.fold, name: "一张图片", des: - "图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述") + "图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述图片描述") ]) ]; @@ -91,30 +87,34 @@ class GalleryExample extends StatelessWidget { return Scaffold( appBar: BrnAppBar( title: "Gallery 图片", - ),body: ListView(children: [ - ListItem( - title: "图片选择控件", - isShowLine: false, - describe: "查看图片列表页", - onPressed: () { - Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) { - return BrnGallerySummaryPage(allConfig: allConfig); - }, - )); - }, ), - ListItem( - title: "图片详情查看", - describe: '跳转第一项的第五张图', - onPressed: () { - Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) { - return GalleryDetailPageThemeExample(); + body: ListView( + children: [ + ListItem( + title: "图片选择控件", + isShowLine: false, + describe: "查看图片列表页", + onPressed: () { + Navigator.push(context, MaterialPageRoute( + builder: (BuildContext context) { + return BrnGallerySummaryPage(allConfig: allConfig); + }, + )); + }, + ), + ListItem( + title: "图片详情查看", + describe: '跳转第一项的第五张图', + onPressed: () { + Navigator.push(context, MaterialPageRoute( + builder: (BuildContext context) { + return GalleryDetailPageThemeExample(); + }, + )); }, - )); - }, + ), + ], ), - ],),); + ); } } diff --git a/example/lib/sample/components/guide/force_guide_example.dart b/example/lib/sample/components/guide/force_guide_example.dart index f8996bac..cb14364c 100644 --- a/example/lib/sample/components/guide/force_guide_example.dart +++ b/example/lib/sample/components/guide/force_guide_example.dart @@ -1,5 +1,3 @@ - - import 'dart:async'; import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/guide/guide_entry_page.dart b/example/lib/sample/components/guide/guide_entry_page.dart index f15dc4b7..ac312e6e 100644 --- a/example/lib/sample/components/guide/guide_entry_page.dart +++ b/example/lib/sample/components/guide/guide_entry_page.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:example/sample/components/guide/force_guide_example.dart'; import 'package:example/sample/components/guide/soft_intro_example.dart'; @@ -8,37 +6,40 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class GuideEntryPage extends StatelessWidget { - @override Widget build(BuildContext context) { return Scaffold( appBar: BrnAppBar( title: "引导示例", - ),body: ListView(children: [ - ListItem( - title: "强引导组件", - isShowLine: false, - describe: '强引导组件example', - onPressed: () { - Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) { - return ForceGuideExample(); - }, - )); - }, ), - ListItem( - title: "弱引导组件", - isSupportTheme: true, - describe: '弱引导组件example', - onPressed: () { - Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) { - return SoftGuideExample(); + body: ListView( + children: [ + ListItem( + title: "强引导组件", + isShowLine: false, + describe: '强引导组件example', + onPressed: () { + Navigator.push(context, MaterialPageRoute( + builder: (BuildContext context) { + return ForceGuideExample(); + }, + )); + }, + ), + ListItem( + title: "弱引导组件", + isSupportTheme: true, + describe: '弱引导组件example', + onPressed: () { + Navigator.push(context, MaterialPageRoute( + builder: (BuildContext context) { + return SoftGuideExample(); + }, + )); }, - )); - }, + ), + ], ), - ],),); + ); } } diff --git a/example/lib/sample/components/guide/soft_intro_example.dart b/example/lib/sample/components/guide/soft_intro_example.dart index bce101cd..d4dfd4aa 100644 --- a/example/lib/sample/components/guide/soft_intro_example.dart +++ b/example/lib/sample/components/guide/soft_intro_example.dart @@ -1,5 +1,3 @@ - - import 'dart:async'; import 'package:bruno/bruno.dart'; diff --git a/example/lib/sample/components/input/input_example.dart b/example/lib/sample/components/input/input_example.dart index eb306cd5..98853e93 100644 --- a/example/lib/sample/components/input/input_example.dart +++ b/example/lib/sample/components/input/input_example.dart @@ -1,11 +1,9 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; class TextModel { - String? text; + String? text; } class BrnInputTextExample extends StatefulWidget { diff --git a/example/lib/sample/components/line/dashed_line_example.dart b/example/lib/sample/components/line/dashed_line_example.dart index 08cf4ff7..ec287905 100644 --- a/example/lib/sample/components/line/dashed_line_example.dart +++ b/example/lib/sample/components/line/dashed_line_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -37,9 +35,10 @@ class _DashedLineExampleState extends State { dashedOffset: 20, position: BrnDashedLinePosition.leading, contentWidget: Container( - margin: EdgeInsets.only(left: 60, right: 20, top: 10, bottom: 10), - child: - Text("穿插介绍、公司模式一句话C端服务承诺介绍、价值穿插介绍、公司模式一句话C端服务承诺介绍、价值穿插介绍、公司模式一句话C端服务承诺介绍、价值"), + margin: + EdgeInsets.only(left: 60, right: 20, top: 10, bottom: 10), + child: Text( + "穿插介绍、公司模式一句话C端服务承诺介绍、价值穿插介绍、公司模式一句话C端服务承诺介绍、价值穿插介绍、公司模式一句话C端服务承诺介绍、价值"), ), ), Text( @@ -77,10 +76,11 @@ class _DashedLineExampleState extends State { color: Colors.red, child: BrnDashedLine( axis: Axis.horizontal, - dashedOffset: 10, contentWidget: Container( - width: 200, - height: 100, - ), + dashedOffset: 10, + contentWidget: Container( + width: 200, + height: 100, + ), ), ), ], diff --git a/example/lib/sample/components/loading/loading_widget_example.dart b/example/lib/sample/components/loading/loading_widget_example.dart index 53b9aa05..f1f64c84 100644 --- a/example/lib/sample/components/loading/loading_widget_example.dart +++ b/example/lib/sample/components/loading/loading_widget_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/navbar/appbar_entry_page.dart b/example/lib/sample/components/navbar/appbar_entry_page.dart index b800a595..31f4f747 100644 --- a/example/lib/sample/components/navbar/appbar_entry_page.dart +++ b/example/lib/sample/components/navbar/appbar_entry_page.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:example/sample/home/list_item.dart'; import 'package:example/sample/components/navbar/nav_bar_example_page.dart'; diff --git a/example/lib/sample/components/navbar/nav_bar_example_page.dart b/example/lib/sample/components/navbar/nav_bar_example_page.dart index aa7ce264..0a9dc3aa 100644 --- a/example/lib/sample/components/navbar/nav_bar_example_page.dart +++ b/example/lib/sample/components/navbar/nav_bar_example_page.dart @@ -38,18 +38,20 @@ class _NavBarPageState extends State with TickerProviderStateMixin { textEditingController = TextEditingController(); valueNotifier = ValueNotifier(false); - selectedHeiStyle = - TextStyle(fontSize: 18, color: Color(0xFFFFFFFF), fontWeight: FontWeight.w600); - selectedBaiStyle = - TextStyle(fontSize: 18, color: Color(0xFF222222), fontWeight: FontWeight.w600); + selectedHeiStyle = TextStyle( + fontSize: 18, color: Color(0xFFFFFFFF), fontWeight: FontWeight.w600); + selectedBaiStyle = TextStyle( + fontSize: 18, color: Color(0xFF222222), fontWeight: FontWeight.w600); - unSelectedHeiStyle = - TextStyle(fontSize: 18, color: Color(0xFF999999), fontWeight: FontWeight.w600); - unSelectedBaiStyle = - TextStyle(fontSize: 18, color: Color(0xFF999999), fontWeight: FontWeight.w600); + unSelectedHeiStyle = TextStyle( + fontSize: 18, color: Color(0xFF999999), fontWeight: FontWeight.w600); + unSelectedBaiStyle = TextStyle( + fontSize: 18, color: Color(0xFF999999), fontWeight: FontWeight.w600); - commonHeiStyle = TextStyle(fontSize: 18, fontWeight: FontWeight.w600, color: Colors.white); - commonBaiStyle = TextStyle(fontSize: 18, fontWeight: FontWeight.w600, color: Color(0xFF222222)); + commonHeiStyle = TextStyle( + fontSize: 18, fontWeight: FontWeight.w600, color: Colors.white); + commonBaiStyle = TextStyle( + fontSize: 18, fontWeight: FontWeight.w600, color: Color(0xFF222222)); focusNode = FocusNode(); focusNode!.addListener(() { @@ -146,8 +148,9 @@ class _NavBarPageState extends State with TickerProviderStateMixin { Widget? widget; switch (this.widget.index) { case 0: - widget = - Center(child: Text('1. 左上角的返回按钮图标支持自定义,本例改成了搜索图标\n2.切换类型的导航栏\n3.顶部模块切换可不限于两个,可多个')); + widget = Center( + child: Text( + '1. 左上角的返回按钮图标支持自定义,本例改成了搜索图标\n2.切换类型的导航栏\n3.顶部模块切换可不限于两个,可多个')); break; case 4: widget = Center(child: Text('多Actions')); @@ -306,13 +309,17 @@ class _NavBarPageState extends State with TickerProviderStateMixin { Text( '标题名称', style: TextStyle( - fontSize: 18, height: 1, fontWeight: FontWeight.w600, color: Color(0xFF222222)), + fontSize: 18, + height: 1, + fontWeight: FontWeight.w600, + color: Color(0xFF222222)), ), Container( height: 17, padding: EdgeInsets.only(left: 3, right: 3), margin: EdgeInsets.only(left: 6), - decoration: BoxDecoration(color: Color(0xff8E8E8E).withOpacity(0.15)), + decoration: + BoxDecoration(color: Color(0xff8E8E8E).withOpacity(0.15)), child: Center( child: Text( '住宅', @@ -480,7 +487,8 @@ class _NavBarPageState extends State with TickerProviderStateMixin { children: [ Text( '类型1', - style: TextStyle(color: Color(0xFF222222), height: 1, fontSize: 16), + style: + TextStyle(color: Color(0xFF222222), height: 1, fontSize: 16), ), Padding( padding: const EdgeInsets.only(left: 5), @@ -561,7 +569,8 @@ class _NavBarPageState extends State with TickerProviderStateMixin { leadClickCallback: (controller, update) { //controller 是文本控制器,通过controller 可以拿到输入的内容 以及 对输入的内容更改 //update 是setState方法的方法命,update() 就可以刷新输入框 - BrnPopupListWindow.showPopListWindow(context, keyLeading, data: ["aaaa", "bbbbb"], offset: 20); + BrnPopupListWindow.showPopListWindow(context, keyLeading, + data: ["aaaa", "bbbbb"], offset: 20); }, //输入框 文本内容变化的监听 searchBarInputChangeCallback: (input) { @@ -656,7 +665,9 @@ class _NavBarPageState extends State with TickerProviderStateMixin { child: Center( child: Text( '标题', - style: index == currentIndex ? selectedHeiStyle : unSelectedHeiStyle, + style: index == currentIndex + ? selectedHeiStyle + : unSelectedHeiStyle, ), ), ); diff --git a/example/lib/sample/components/noticebar/brn_notice_bar_example.dart b/example/lib/sample/components/noticebar/brn_notice_bar_example.dart index e89ddfa9..9b8f45f7 100644 --- a/example/lib/sample/components/noticebar/brn_notice_bar_example.dart +++ b/example/lib/sample/components/noticebar/brn_notice_bar_example.dart @@ -144,7 +144,8 @@ class BrnNoticeBarExample extends StatelessWidget { describe: '点击可查看样式1更多example', describeColor: Color(0xFF0984F9), onPressed: () { - Navigator.of(context).push(MaterialPageRoute(builder: (context) { + Navigator.of(context) + .push(MaterialPageRoute(builder: (context) { return BrnNoticeBarExample(); })); }, @@ -164,7 +165,8 @@ class BrnNoticeBarExample extends StatelessWidget { describe: '点击可查看样式2更多example', describeColor: Color(0xFF0984F9), onPressed: () { - Navigator.of(context).push(MaterialPageRoute(builder: (context) { + Navigator.of(context) + .push(MaterialPageRoute(builder: (context) { return BrnNoticeBarWithButtonExample(); })); }, diff --git a/example/lib/sample/components/noticebar/notice_bar_example.dart b/example/lib/sample/components/noticebar/notice_bar_example.dart index 073ac2c4..438dc52a 100644 --- a/example/lib/sample/components/noticebar/notice_bar_example.dart +++ b/example/lib/sample/components/noticebar/notice_bar_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/noticebar/notice_bar_with_button_example.dart b/example/lib/sample/components/noticebar/notice_bar_with_button_example.dart index be11f666..8a3243ca 100644 --- a/example/lib/sample/components/noticebar/notice_bar_with_button_example.dart +++ b/example/lib/sample/components/noticebar/notice_bar_with_button_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -26,7 +24,8 @@ class BrnNoticeBarWithButtonExample extends StatelessWidget { ), BrnBubbleText( maxLines: 3, - text: '高度56,左边为标签,中间是通知内容,右边是按钮, 其中通知内容必传,标签和按钮文案如果是空,就不显示。所有颜色均支持自定义', + text: + '高度56,左边为标签,中间是通知内容,右边是按钮, 其中通知内容必传,标签和按钮文案如果是空,就不显示。所有颜色均支持自定义', ), Text( '默认样式', diff --git a/example/lib/sample/components/picker/cutomer_bottom_picker_example.dart b/example/lib/sample/components/picker/cutomer_bottom_picker_example.dart index e63e6188..144f9981 100644 --- a/example/lib/sample/components/picker/cutomer_bottom_picker_example.dart +++ b/example/lib/sample/components/picker/cutomer_bottom_picker_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:example/sample/home/list_item.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/picker/date_picker_example.dart b/example/lib/sample/components/picker/date_picker_example.dart index ece9492a..151c0064 100644 --- a/example/lib/sample/components/picker/date_picker_example.dart +++ b/example/lib/sample/components/picker/date_picker_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:example/sample/home/list_item.dart'; import 'package:flutter/material.dart'; @@ -49,7 +47,8 @@ class DatePickerExamplePage extends StatelessWidget { title: "Time Range Style", describe: '时间范围选择器-不限制选择的时间范围', onPressed: () { - _showRangePickerNoLimited(context, BrnDateTimeRangePickerMode.time); + _showRangePickerNoLimited( + context, BrnDateTimeRangePickerMode.time); }, ), ListItem( @@ -149,7 +148,8 @@ class DatePickerExamplePage extends StatelessWidget { }); } - _showRangePickerNoLimited(BuildContext context, BrnDateTimeRangePickerMode mode) { + _showRangePickerNoLimited( + BuildContext context, BrnDateTimeRangePickerMode mode) { String format; const String MIN_DATETIME = '2020-01-01 00:00:00'; const String MAX_DATETIME = '2020-12-31 23:59:59'; @@ -170,14 +170,16 @@ class DatePickerExamplePage extends StatelessWidget { initialEndDateTime: DateTime(2020, 06, 23, 10, 00, 00), onConfirm: (startDateTime, endDateTime, startlist, endlist) { BrnToast.show( - "onConfirm: $startDateTime $endDateTime $startlist $endlist", context); + "onConfirm: $startDateTime $endDateTime $startlist $endlist", + context); }, onClose: () { print("onClose"); }, onCancel: () { print("onCancel"); }, onChange: (startDateTime, endDateTime, startlist, endlist) { BrnToast.show( - "onChange: $startDateTime $endDateTime $startlist $endlist", context); + "onChange: $startDateTime $endDateTime $startlist $endlist", + context); }); } @@ -188,7 +190,8 @@ class DatePickerExamplePage extends StatelessWidget { switch (mode) { case BrnDateTimeRangePickerMode.date: format = 'MM月-dd日'; - BrnPickerTitleConfig pickerTitleConfig = BrnPickerTitleConfig(titleContent: "选择时间范围"); + BrnPickerTitleConfig pickerTitleConfig = + BrnPickerTitleConfig(titleContent: "选择时间范围"); BrnDateRangePicker.showDatePicker(context, isDismissible: false, minDateTime: DateTime.parse(MIN_DATETIME), @@ -199,20 +202,24 @@ class DatePickerExamplePage extends StatelessWidget { initialStartDateTime: DateTime(2021, 06, 21, 11, 00, 00), initialEndDateTime: DateTime(2021, 06, 23, 10, 00, 00), onConfirm: (startDateTime, endDateTime, startlist, endlist) { - BrnToast.show("onConfirm: $startDateTime $endDateTime $startlist $endlist", context); - }, onClose: () { - print("onClose"); - }, onCancel: () { - print("onCancel"); - }, - onChange: (startDateTime, endDateTime, startlist, endlist) { - BrnToast.show("onChange: $startDateTime $endDateTime $startlist $endlist", context); - }); + BrnToast.show( + "onConfirm: $startDateTime $endDateTime $startlist $endlist", + context); + }, onClose: () { + print("onClose"); + }, onCancel: () { + print("onCancel"); + }, onChange: (startDateTime, endDateTime, startlist, endlist) { + BrnToast.show( + "onChange: $startDateTime $endDateTime $startlist $endlist", + context); + }); break; case BrnDateTimeRangePickerMode.time: format = 'HH时:mm分'; - BrnPickerTitleConfig pickerTitleConfig = BrnPickerTitleConfig(titleContent: "选择时间范围"); + BrnPickerTitleConfig pickerTitleConfig = + BrnPickerTitleConfig(titleContent: "选择时间范围"); BrnDateRangePicker.showDatePicker(context, minDateTime: DateTime.parse(MIN_DATETIME), maxDateTime: DateTime.parse(MAX_DATETIME), @@ -224,14 +231,16 @@ class DatePickerExamplePage extends StatelessWidget { initialEndDateTime: DateTime(2020, 06, 23, 10, 00, 00), onConfirm: (startDateTime, endDateTime, startlist, endlist) { BrnToast.show( - "onConfirm: $startDateTime $endDateTime $startlist $endlist", context); + "onConfirm: $startDateTime $endDateTime $startlist $endlist", + context); }, onClose: () { print("onClose"); }, onCancel: () { print("onCancel"); }, onChange: (startDateTime, endDateTime, startlist, endlist) { BrnToast.show( - "onChange: $startDateTime $endDateTime $startlist $endlist", context); + "onChange: $startDateTime $endDateTime $startlist $endlist", + context); }); break; default: @@ -240,8 +249,9 @@ class DatePickerExamplePage extends StatelessWidget { } void _showyyyyMMddRangePicker(BuildContext context) { - String format = 'yyyy年-MM月-dd日'; - BrnPickerTitleConfig pickerTitleConfig = BrnPickerTitleConfig(titleContent: "选择时间范围"); + String format = 'yyyy年-MM月-dd日'; + BrnPickerTitleConfig pickerTitleConfig = + BrnPickerTitleConfig(titleContent: "选择时间范围"); BrnDateRangePicker.showDatePicker(context, isDismissible: false, minDateTime: DateTime(2010, 06, 01, 00, 00, 00), @@ -253,15 +263,17 @@ class DatePickerExamplePage extends StatelessWidget { initialStartDateTime: DateTime(2020, 06, 21, 11, 00, 00), initialEndDateTime: DateTime(2020, 06, 23, 10, 00, 00), onConfirm: (startDateTime, endDateTime, startlist, endlist) { - BrnToast.show( - "onConfirm: $startDateTime $endDateTime $startlist $endlist", context); - }, onClose: () { - print("onClose"); - }, onCancel: () { - print("onCancel"); - }, onChange: (startDateTime, endDateTime, startlist, endlist) { - BrnToast.show( - "onChange: $startDateTime $endDateTime $startlist $endlist", context); - }); + BrnToast.show( + "onConfirm: $startDateTime $endDateTime $startlist $endlist", + context); + }, onClose: () { + print("onClose"); + }, onCancel: () { + print("onCancel"); + }, onChange: (startDateTime, endDateTime, startlist, endlist) { + BrnToast.show( + "onChange: $startDateTime $endDateTime $startlist $endlist", + context); + }); } } diff --git a/example/lib/sample/components/picker/multi_picker_example.dart b/example/lib/sample/components/picker/multi_picker_example.dart index 68aa5cfa..fc9d09dd 100644 --- a/example/lib/sample/components/picker/multi_picker_example.dart +++ b/example/lib/sample/components/picker/multi_picker_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:example/sample/home/list_item.dart'; import 'package:flutter/material.dart'; @@ -99,7 +97,8 @@ class MultiPickerExamplePage extends StatelessWidget { BrnMultiDataPicker( context: context, title: '来源', - delegate: Brn2RowDelegate(firstSelectedIndex: 1, secondSelectedIndex: 0), + delegate: Brn2RowDelegate( + firstSelectedIndex: 1, secondSelectedIndex: 0), confirmClick: (list) { BrnToast.show(list.toString(), context); }, @@ -114,7 +113,8 @@ class MultiPickerExamplePage extends StatelessWidget { sync: false, context: context, title: '来源', - delegate: Brn2RowCustomDelegate(firstSelectedIndex: 1, secondSelectedIndex: 0), + delegate: Brn2RowCustomDelegate( + firstSelectedIndex: 1, secondSelectedIndex: 0), confirmClick: (list) { BrnToast.show(list.toString(), context); }, @@ -129,7 +129,9 @@ class MultiPickerExamplePage extends StatelessWidget { context: context, title: '来源', delegate: Brn3RowDelegate( - firstSelectedIndex: 1, secondSelectedIndex: 0, thirdSelectedIndex: 0), + firstSelectedIndex: 1, + secondSelectedIndex: 0, + thirdSelectedIndex: 0), confirmClick: (list) { BrnToast.show(list.toString(), context); }, @@ -361,7 +363,8 @@ class Brn2RowCustomDelegate implements BrnMultiDataPickerDelegate { int firstSelectedIndex = 0; int secondSelectedIndex = 0; - Brn2RowCustomDelegate({this.firstSelectedIndex = 0, this.secondSelectedIndex = 0}); + Brn2RowCustomDelegate( + {this.firstSelectedIndex = 0, this.secondSelectedIndex = 0}); @override int numberOfComponent() { diff --git a/example/lib/sample/components/picker/picker_entry_page.dart b/example/lib/sample/components/picker/picker_entry_page.dart index 42e2fb84..f0b2414b 100644 --- a/example/lib/sample/components/picker/picker_entry_page.dart +++ b/example/lib/sample/components/picker/picker_entry_page.dart @@ -1,5 +1,3 @@ - - import 'dart:convert'; import 'package:bruno/bruno.dart'; @@ -82,10 +80,11 @@ class PickerEntryPage extends StatelessWidget { describe: "底部级联选择框", onPressed: () { rootBundle.loadString('assets/list_picker.json').then((data) { - List _selectionData = [] - ..addAll((JsonDecoder().convert(data)["data"]['list'] as List? ?? []) - .map((o) => BrnPickerEntity.fromMap(o))); - if ( _selectionData.length > 0) { + List _selectionData = []..addAll( + (JsonDecoder().convert(data)["data"]['list'] as List? ?? + []) + .map((o) => BrnPickerEntity.fromMap(o))); + if (_selectionData.length > 0) { _selectionData.forEach((f) => f.configChild()); if (dataList.length == 0) { dataList.addAll(_selectionData); @@ -100,9 +99,10 @@ class PickerEntryPage extends StatelessWidget { describe: "底部级联选择框(Title 动态改变)", onPressed: () { rootBundle.loadString('assets/list_picker.json').then((data) { - List _selectionData = [] - ..addAll((JsonDecoder().convert(data)["data"]['list'] as List? ?? []) - .map((o) => BrnPickerEntity.fromMap(o))); + List _selectionData = []..addAll( + (JsonDecoder().convert(data)["data"]['list'] as List? ?? + []) + .map((o) => BrnPickerEntity.fromMap(o))); if (_selectionData.length > 0) { _selectionData.forEach((f) => f.configChild()); if (dataList.length == 0) { @@ -134,8 +134,10 @@ class PickerEntryPage extends StatelessWidget { List items = []; items.add(new BrnMultiSelectBottomPickerItem("100", "这里是标题1")); items.add(new BrnMultiSelectBottomPickerItem("101", "这里是标题2")); - items.add(new BrnMultiSelectBottomPickerItem("102", "这里是标题3", isChecked: true)); - items.add(new BrnMultiSelectBottomPickerItem("103", "这里是标题4", isChecked: true)); + items.add( + new BrnMultiSelectBottomPickerItem("102", "这里是标题3", isChecked: true)); + items.add( + new BrnMultiSelectBottomPickerItem("103", "这里是标题4", isChecked: true)); items.add(new BrnMultiSelectBottomPickerItem("104", "这里是标题5")); items.add(new BrnMultiSelectBottomPickerItem("104", "这里是标题6")); BrnMultiSelectListPicker.show( @@ -158,8 +160,10 @@ class PickerEntryPage extends StatelessWidget { List items = []; items.add(new BrnMultiSelectBottomPickerItem("100", "这里是标题1")); items.add(new BrnMultiSelectBottomPickerItem("101", "这里是标题2")); - items.add(new BrnMultiSelectBottomPickerItem("102", "这里是标题3", isChecked: true)); - items.add(new BrnMultiSelectBottomPickerItem("103", "这里是标题4", isChecked: true)); + items.add( + new BrnMultiSelectBottomPickerItem("102", "这里是标题3", isChecked: true)); + items.add( + new BrnMultiSelectBottomPickerItem("103", "这里是标题4", isChecked: true)); items.add(new BrnMultiSelectBottomPickerItem("104", "这里是标题5")); items.add(new BrnMultiSelectBottomPickerItem("104", "这里是标题6")); showModalBottomSheet( @@ -214,7 +218,8 @@ class PickerEntryPage extends StatelessWidget { ); } - void _showRangePicker(BuildContext context, List _selectionData) { + void _showRangePicker( + BuildContext context, List _selectionData) { _selectionData.forEach((f) => f.configChild()); var selectionMenuView = BrnMultiColumnPicker( entity: _selectionData[3], @@ -244,7 +249,8 @@ class PickerEntryPage extends StatelessWidget { ); } - void _showRangePicker1(BuildContext context, List _selectionData) { + void _showRangePicker1( + BuildContext context, List _selectionData) { _selectionData.forEach((f) => f.configChild()); String titleName = "测试标题"; showModalBottomSheet( @@ -255,8 +261,8 @@ class PickerEntryPage extends StatelessWidget { pickerTitleConfig: BrnPickerTitleConfig(titleContent: titleName), entity: _selectionData[3], defaultFocusedIndexes: [0, -1, -1], - onConfirm: (Map> result, int? firstIndex, - int? secondIndex, int? thirdIndex) { + onConfirm: (Map> result, + int? firstIndex, int? secondIndex, int? thirdIndex) { List pickResult = []; result.forEach((key, val) { List tmp = []; @@ -353,7 +359,8 @@ class PickerEntryPage extends StatelessWidget { List items = []; for (int i = 0; i < tags.length; i++) { String it = tags[i]; - BrnTagInputItemBean item = BrnTagInputItemBean(name: it, index: i, needExpend: (i % 2 == 0)); + BrnTagInputItemBean item = + BrnTagInputItemBean(name: it, index: i, needExpend: (i % 2 == 0)); items.add(item); } diff --git a/example/lib/sample/components/popup/overlay_window_example.dart b/example/lib/sample/components/popup/overlay_window_example.dart index 13f7c8fd..6ff8abab 100644 --- a/example/lib/sample/components/popup/overlay_window_example.dart +++ b/example/lib/sample/components/popup/overlay_window_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -48,8 +46,10 @@ class OverlayWindowExamplePageState extends State { innerColor: Colors.white, hintText: "请输入小区名称", borderRadius: BorderRadius.all(Radius.circular(10)), - normalBorder: Border.all(color: Color(0xFF999999), width: 1, style: BorderStyle.solid), - activeBorder: Border.all(color: Color(0xFF0984F9), width: 1, style: BorderStyle.solid), + normalBorder: Border.all( + color: Color(0xFF999999), width: 1, style: BorderStyle.solid), + activeBorder: Border.all( + color: Color(0xFF0984F9), width: 1, style: BorderStyle.solid), focusNode: _focusNode, onTextClear: () { _focusNode.unfocus(); @@ -68,8 +68,10 @@ class OverlayWindowExamplePageState extends State { _overlayController?.removeOverlay(); return; } - if (_overlayController == null || _overlayController!.isOverlayShowing == false) { - _overlayController = BrnOverlayWindow.showOverlayWindow(context, _searchBarKey, + if (_overlayController == null || + _overlayController!.isOverlayShowing == false) { + _overlayController = BrnOverlayWindow.showOverlayWindow( + context, _searchBarKey, content: _sugListView(), autoDismissOnTouchOutSide: true, popDirection: BrnOverlayPopDirection.bottom); diff --git a/example/lib/sample/components/popup/popwindow_example.dart b/example/lib/sample/components/popup/popwindow_example.dart index 47dbbcf9..26db9315 100644 --- a/example/lib/sample/components/popup/popwindow_example.dart +++ b/example/lib/sample/components/popup/popwindow_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -63,7 +61,8 @@ class PopWindowExamplePageState extends State { child: ElevatedButton( key: _leftKey1, onPressed: () { - BrnPopupWindow.showPopWindow(context, "提示内容提示内容提示内容提示内容提示内容提示内容提示内容提示内容", _leftKey1!, + BrnPopupWindow.showPopWindow( + context, "提示内容提示内容提示内容提示内容提示内容提示内容提示内容提示内容", _leftKey1!, hasCloseIcon: false); }, child: Text("左侧带无关闭Tips"), @@ -74,8 +73,10 @@ class PopWindowExamplePageState extends State { child: ElevatedButton( key: _leftKey2, onPressed: () { - BrnPopupWindow.showPopWindow(context, "提示内容提示内容提示内容提示内容提示内容提示内容提示内容提示内容提示内容", _leftKey2!, - popDirection: BrnPopupDirection.top, hasCloseIcon: true); + BrnPopupWindow.showPopWindow(context, + "提示内容提示内容提示内容提示内容提示内容提示内容提示内容提示内容提示内容", _leftKey2!, + popDirection: BrnPopupDirection.top, + hasCloseIcon: true); }, child: Text("左侧带关闭,箭头朝下Tips"), ), @@ -85,8 +86,10 @@ class PopWindowExamplePageState extends State { child: ElevatedButton( key: _leftKey3, onPressed: () { - BrnPopupWindow.showPopWindow(context, "提示内容提示内容提示内容提示内容提示内容提示内容提示内容提示内容", _leftKey3!, - dismissCallback: () {}, popDirection: BrnPopupDirection.top); + BrnPopupWindow.showPopWindow( + context, "提示内容提示内容提示内容提示内容提示内容提示内容提示内容提示内容", _leftKey3!, + dismissCallback: () {}, + popDirection: BrnPopupDirection.top); }, child: Text("左侧无关闭,箭头朝下Tips"), ), @@ -96,7 +99,8 @@ class PopWindowExamplePageState extends State { child: ElevatedButton( key: _leftKey4, onPressed: () { - BrnPopupWindow.showPopWindow(context, "提示内容提示内容提示内容提示内容提示内容提示内容提示内容提示内容", _leftKey4!, + BrnPopupWindow.showPopWindow( + context, "提示内容提示内容提示内容提示内容提示内容提示内容提示内容提示内容", _leftKey4!, hasCloseIcon: true, dismissCallback: () {}, popDirection: BrnPopupDirection.bottom); @@ -109,7 +113,8 @@ class PopWindowExamplePageState extends State { child: ElevatedButton( key: _leftKey5, onPressed: () { - BrnPopupWindow.showPopWindow(context, "提示内容提示内容提示内容提示内容", _leftKey5!, + BrnPopupWindow.showPopWindow( + context, "提示内容提示内容提示内容提示内容", _leftKey5!, hasCloseIcon: false, dismissCallback: () {}, popDirection: BrnPopupDirection.bottom); @@ -122,7 +127,8 @@ class PopWindowExamplePageState extends State { child: ElevatedButton( key: _leftKey6, onPressed: () { - BrnPopupWindow.showPopWindow(context, "提示内容提示内容提示内容提示内容提示内容提示内容", _leftKey6!, + BrnPopupWindow.showPopWindow( + context, "提示内容提示内容提示内容提示内容提示内容提示内容", _leftKey6!, hasCloseIcon: true, canWrap: false, dismissCallback: () {}, @@ -136,7 +142,8 @@ class PopWindowExamplePageState extends State { child: ElevatedButton( key: _leftKey7, onPressed: () { - BrnPopupWindow.showPopWindow(context, "提示内容提示内容提示内容提示内容提示内容提示内容", _leftKey7!, + BrnPopupWindow.showPopWindow( + context, "提示内容提示内容提示内容提示内容提示内容提示内容", _leftKey7!, hasCloseIcon: false, dismissCallback: () {}, popDirection: BrnPopupDirection.top); diff --git a/example/lib/sample/components/rating/rating_example.dart b/example/lib/sample/components/rating/rating_example.dart index 61acdb71..87c763b7 100644 --- a/example/lib/sample/components/rating/rating_example.dart +++ b/example/lib/sample/components/rating/rating_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -74,12 +72,14 @@ class _RatingExampleState extends State { Widget _buildRating(RatingState state) { switch (state) { case RatingState.select: - return BrunoTools.getAssetSizeImage(BrnAsset.iconStar, 16, 16, color: Color(0xFF3571DC)); + return BrunoTools.getAssetSizeImage(BrnAsset.iconStar, 16, 16, + color: Color(0xFF3571DC)); case RatingState.half: return BrunoTools.getAssetSizeImage(BrnAsset.iconStarHalf, 16, 16); case RatingState.unselect: default: - return BrunoTools.getAssetSizeImage(BrnAsset.iconStar, 16, 16, color: Color(0xFFF0F0F0)); + return BrunoTools.getAssetSizeImage(BrnAsset.iconStar, 16, 16, + color: Color(0xFFF0F0F0)); } } } diff --git a/example/lib/sample/components/scroll_anchor/scroll_actor_tab_example.dart b/example/lib/sample/components/scroll_anchor/scroll_actor_tab_example.dart index ffba733b..85ede17d 100644 --- a/example/lib/sample/components/scroll_anchor/scroll_actor_tab_example.dart +++ b/example/lib/sample/components/scroll_anchor/scroll_actor_tab_example.dart @@ -1,5 +1,3 @@ - - import 'dart:math'; import 'package:bruno/bruno.dart'; @@ -23,9 +21,7 @@ class ScrollActorTabExample extends StatelessWidget { ); }, tabIndexedBuilder: (context, index) { - return BadgeTab( - text: 'index $index' - ); + return BadgeTab(text: 'index $index'); }, ), ); diff --git a/example/lib/sample/components/selectcity/selected_city_example.dart b/example/lib/sample/components/selectcity/selected_city_example.dart index 0f6fdfb6..62d9bf9d 100644 --- a/example/lib/sample/components/selectcity/selected_city_example.dart +++ b/example/lib/sample/components/selectcity/selected_city_example.dart @@ -1,5 +1,3 @@ - - import 'dart:convert'; import 'package:bruno/bruno.dart'; @@ -134,7 +132,8 @@ class _CitySelectRouteState extends State { flex: 1, child: AzListView( data: _cityList, - itemBuilder: (context, model) => _buildListItem(model as BrnSelectCityModel), + itemBuilder: (context, model) => + _buildListItem(model as BrnSelectCityModel), suspensionWidget: _buildSusWidget(_suspensionTag), isUseRealIndex: true, itemHeight: _itemHeight, diff --git a/example/lib/sample/components/selection/filter_entity.dart b/example/lib/sample/components/selection/filter_entity.dart index 50d19dfb..4dd9b1d7 100644 --- a/example/lib/sample/components/selection/filter_entity.dart +++ b/example/lib/sample/components/selection/filter_entity.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; class BrnFilterEntity { @@ -12,6 +10,7 @@ class BrnFilterEntity { key = map['key'] ?? ''; name = map['title'] ?? ''; defaultValue = map['defaultValue'] ?? ''; - children = []..addAll((map['children'] as List? ?? []).map((o) => ItemEntity.fromJson(o))); + children = []..addAll( + (map['children'] as List? ?? []).map((o) => ItemEntity.fromJson(o))); } } diff --git a/example/lib/sample/components/selection/flat_selection_five_tags_example.dart b/example/lib/sample/components/selection/flat_selection_five_tags_example.dart index 26b27bfd..a7ed89d6 100644 --- a/example/lib/sample/components/selection/flat_selection_five_tags_example.dart +++ b/example/lib/sample/components/selection/flat_selection_five_tags_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -10,10 +8,12 @@ class NewSelectionViewExamplePage23 extends StatefulWidget { NewSelectionViewExamplePage23(this._title, this._filterData); @override - _SelectionViewExamplePageState createState() => _SelectionViewExamplePageState(); + _SelectionViewExamplePageState createState() => + _SelectionViewExamplePageState(); } -class _SelectionViewExamplePageState extends State { +class _SelectionViewExamplePageState + extends State { BrnSelectionEntity? entity; BrnFlatSelectionController? controller; @@ -67,7 +67,8 @@ class _SelectionViewExamplePageState extends State str = str + " " + '$k: $v'); + data.forEach( + (k, v) => str = str + " " + '$k: $v'); BrnToast.show(str, context); }, controller: controller)), @@ -100,11 +101,13 @@ class _SelectionViewExamplePageState extends State _SelectionViewExamplePageState(); + _SelectionViewExamplePageState createState() => + _SelectionViewExamplePageState(); } -class _SelectionViewExamplePageState extends State { +class _SelectionViewExamplePageState + extends State { BrnSelectionEntity? entity; BrnFlatSelectionController? controller; @@ -67,7 +67,8 @@ class _SelectionViewExamplePageState extends State entityDataList: widget._filterData, confirmCallback: (data) { var str = ""; - data.forEach((k, v) => str = str + " " + '$k: $v'); + data.forEach( + (k, v) => str = str + " " + '$k: $v'); BrnToast.show(str, context); }, controller: controller)), @@ -100,11 +101,13 @@ class _SelectionViewExamplePageState extends State Container( height: 24, width: 24, - child: BrunoTools.getAssetImage(BrnAsset.iconSelectionReset), + child: BrunoTools.getAssetImage( + BrnAsset.iconSelectionReset), ), Text( "重置", - style: TextStyle(fontSize: 11, color: Color(0xFF999999)), + style: + TextStyle(fontSize: 11, color: Color(0xFF999999)), ) ], ), @@ -152,5 +155,4 @@ class _SelectionViewExamplePageState extends State ], ); } - } diff --git a/example/lib/sample/components/selection/flat_selection_three_tags_example.dart b/example/lib/sample/components/selection/flat_selection_three_tags_example.dart index 45cc975b..85b76582 100644 --- a/example/lib/sample/components/selection/flat_selection_three_tags_example.dart +++ b/example/lib/sample/components/selection/flat_selection_three_tags_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -10,10 +8,12 @@ class FlatSelectionThreeTagsExample extends StatefulWidget { FlatSelectionThreeTagsExample(this._title, this._filterData); @override - _SelectionViewExamplePageState createState() => _SelectionViewExamplePageState(); + _SelectionViewExamplePageState createState() => + _SelectionViewExamplePageState(); } -class _SelectionViewExamplePageState extends State { +class _SelectionViewExamplePageState + extends State { BrnSelectionEntity? entity; BrnFlatSelectionController? controller; @@ -66,7 +66,8 @@ class _SelectionViewExamplePageState extends State str = str + " " + '$k: $v'); + data.forEach( + (k, v) => str = str + " " + '$k: $v'); BrnToast.show(str, context); }, controller: controller)), @@ -99,11 +100,13 @@ class _SelectionViewExamplePageState extends State 0) { for (BrnSelectionEntity child in entity.children) { @@ -205,7 +242,8 @@ class SelectionEntryPage extends StatelessWidget { } _configMaxSelectedCount(datas[0], 5); - var page = SelectionViewLimitMaxSelectedCountExamplePage("限制选择最大数量", datas); + var page = SelectionViewLimitMaxSelectedCountExamplePage( + "限制选择最大数量", datas); Navigator.push(context, MaterialPageRoute( builder: (BuildContext context) { return page; @@ -218,10 +256,15 @@ class SelectionEntryPage extends StatelessWidget { title: "更多筛选-跳转自定义二级页面", isSupportTheme: true, onPressed: () { - rootBundle.loadString('assets/more_custom_floating_layer_filter.json').then((data) { + rootBundle + .loadString('assets/more_custom_floating_layer_filter.json') + .then((data) { List? datas = - BrnSelectionEntityListBean.fromJson(JsonDecoder().convert(data)["data"])!.list; - var page = SelectionViewMoreCustomFloatLayerExamplePage("更多筛选-跳转自定义二级页面", datas); + BrnSelectionEntityListBean.fromJson( + JsonDecoder().convert(data)["data"])! + .list; + var page = SelectionViewMoreCustomFloatLayerExamplePage( + "更多筛选-跳转自定义二级页面", datas); Navigator.push(context, MaterialPageRoute( builder: (BuildContext context) { return page; diff --git a/example/lib/sample/components/selection/selection_flat_entry_page.dart b/example/lib/sample/components/selection/selection_flat_entry_page.dart index c10ba73d..1ffe82cc 100644 --- a/example/lib/sample/components/selection/selection_flat_entry_page.dart +++ b/example/lib/sample/components/selection/selection_flat_entry_page.dart @@ -1,5 +1,3 @@ - - import 'dart:convert'; import 'package:bruno/bruno.dart'; @@ -10,7 +8,6 @@ import 'package:example/sample/home/list_item.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; - class FlatSelectionEntryPage extends StatelessWidget { @override Widget build(BuildContext context) { @@ -24,17 +21,24 @@ class FlatSelectionEntryPage extends StatelessWidget { padding: EdgeInsets.fromLTRB(15, 5, 15, 5), child: Text( "BrnSelectionView 组件:", - style: TextStyle(fontSize: 20, fontWeight: FontWeight.w600, color: Colors.purple), + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.w600, + color: Colors.purple), ), ), Divider(indent: 15), ListItem( title: "新筛选示例(更多里面抽出平级筛选+一行3个tag)", onPressed: () { - rootBundle.loadString('assets/flat_selection_filter.json').then((data) { - var datas = - BrnSelectionEntityListBean.fromJson(JsonDecoder().convert(data)["data"])!.list!; - void _configMaxSelectedCount(BrnSelectionEntity entity, int maxCount) { + rootBundle + .loadString('assets/flat_selection_filter.json') + .then((data) { + var datas = BrnSelectionEntityListBean.fromJson( + JsonDecoder().convert(data)["data"])! + .list!; + void _configMaxSelectedCount( + BrnSelectionEntity entity, int maxCount) { entity.maxSelectedCount = maxCount; if (entity.children.length > 0) { for (BrnSelectionEntity child in entity.children) { @@ -44,7 +48,8 @@ class FlatSelectionEntryPage extends StatelessWidget { } _configMaxSelectedCount(datas[0].children[1], 5); - var page = FlatSelectionThreeTagsExample("新筛选示例(更多里面抽出平级筛选+一行3个tag)", datas); + var page = FlatSelectionThreeTagsExample( + "新筛选示例(更多里面抽出平级筛选+一行3个tag)", datas); Navigator.push(context, MaterialPageRoute( builder: (BuildContext context) { return page; @@ -56,10 +61,14 @@ class FlatSelectionEntryPage extends StatelessWidget { ListItem( title: "新筛选示例(更多里面抽出平级筛选+一行4个tag)", onPressed: () { - rootBundle.loadString('assets/flat_selection_filter.json').then((data) { - var datas = - BrnSelectionEntityListBean.fromJson(JsonDecoder().convert(data)["data"])!.list!; - void _configMaxSelectedCount(BrnSelectionEntity entity, int maxCount) { + rootBundle + .loadString('assets/flat_selection_filter.json') + .then((data) { + var datas = BrnSelectionEntityListBean.fromJson( + JsonDecoder().convert(data)["data"])! + .list!; + void _configMaxSelectedCount( + BrnSelectionEntity entity, int maxCount) { entity.maxSelectedCount = maxCount; if (entity.children.length > 0) { for (BrnSelectionEntity child in entity.children) { @@ -69,7 +78,8 @@ class FlatSelectionEntryPage extends StatelessWidget { } _configMaxSelectedCount(datas[0].children[1], 5); - var page = FlatSelectionFourTagsExample("新筛选示例(更多里面抽出平级筛选+一行4个tag)", datas); + var page = FlatSelectionFourTagsExample( + "新筛选示例(更多里面抽出平级筛选+一行4个tag)", datas); Navigator.push(context, MaterialPageRoute( builder: (BuildContext context) { return page; @@ -81,10 +91,14 @@ class FlatSelectionEntryPage extends StatelessWidget { ListItem( title: "新筛选示例(更多里面抽出平级筛选+一行5个tag)", onPressed: () { - rootBundle.loadString('assets/flat_selection_filter.json').then((data) { - var datas = - BrnSelectionEntityListBean.fromJson(JsonDecoder().convert(data)["data"])!.list!; - void _configMaxSelectedCount(BrnSelectionEntity entity, int maxCount) { + rootBundle + .loadString('assets/flat_selection_filter.json') + .then((data) { + var datas = BrnSelectionEntityListBean.fromJson( + JsonDecoder().convert(data)["data"])! + .list!; + void _configMaxSelectedCount( + BrnSelectionEntity entity, int maxCount) { entity.maxSelectedCount = maxCount; if (entity.children.length > 0) { for (BrnSelectionEntity child in entity.children) { @@ -94,7 +108,8 @@ class FlatSelectionEntryPage extends StatelessWidget { } _configMaxSelectedCount(datas[0].children[1], 5); - var page = NewSelectionViewExamplePage23("新筛选示例(更多里面抽出平级筛选+一行5个tag)", datas); + var page = NewSelectionViewExamplePage23( + "新筛选示例(更多里面抽出平级筛选+一行5个tag)", datas); Navigator.push(context, MaterialPageRoute( builder: (BuildContext context) { return page; diff --git a/example/lib/sample/components/selection/selectionview_custom_floating_layer_example.dart b/example/lib/sample/components/selection/selectionview_custom_floating_layer_example.dart index e01167c2..35575acc 100644 --- a/example/lib/sample/components/selection/selectionview_custom_floating_layer_example.dart +++ b/example/lib/sample/components/selection/selectionview_custom_floating_layer_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:example/sample/components/card/bubble/common_bubble_example.dart'; import 'package:flutter/material.dart'; @@ -11,10 +9,12 @@ class SelectionViewMoreCustomFloatLayerExamplePage extends StatefulWidget { SelectionViewMoreCustomFloatLayerExamplePage(this._title, this._filterData); @override - _SelectionViewExamplePageState createState() => _SelectionViewExamplePageState(); + _SelectionViewExamplePageState createState() => + _SelectionViewExamplePageState(); } -class _SelectionViewExamplePageState extends State { +class _SelectionViewExamplePageState + extends State { List? items; BrnSelectionViewController? controller; @@ -54,7 +54,8 @@ class _SelectionViewExamplePageState extends State resultEntity = []; result.forEach((userId, userName) { resultEntity.add(BrnSelectionEntity( - value: userId, title: userName, isSelected: true, type: 'radio')); + value: userId, + title: userName, + isSelected: true, + type: 'radio')); }); resultCallBack(resultEntity); }); @@ -81,7 +85,9 @@ class _SelectionViewExamplePageState extends State customParams, BrnSetCustomSelectionMenuTitle setCustomTitleFunction) { BrnToast.show( - 'filterParams : $filterParams' + ',\n customParams : $customParams', context); + 'filterParams : $filterParams' + + ',\n customParams : $customParams', + context); }, ), Container( diff --git a/example/lib/sample/components/selection/selectionview_customhandle_filter_example_page.dart b/example/lib/sample/components/selection/selectionview_customhandle_filter_example_page.dart index 7e122c0b..dbdc9e05 100644 --- a/example/lib/sample/components/selection/selectionview_customhandle_filter_example_page.dart +++ b/example/lib/sample/components/selection/selectionview_customhandle_filter_example_page.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -10,10 +8,12 @@ class SelectionViewCustomHandleFilterExamplePage extends StatefulWidget { SelectionViewCustomHandleFilterExamplePage(this._title, this._filters); @override - _SelectionViewExamplePageState createState() => _SelectionViewExamplePageState(); + _SelectionViewExamplePageState createState() => + _SelectionViewExamplePageState(); } -class _SelectionViewExamplePageState extends State { +class _SelectionViewExamplePageState + extends State { int count = 0; @override @@ -29,11 +29,14 @@ class _SelectionViewExamplePageState extends State[ BrnSelectionView( originalSelectionData: widget._filters!, - onCustomSelectionMenuClick: (int index, BrnSelectionEntity customMenuItem, + onCustomSelectionMenuClick: (int index, + BrnSelectionEntity customMenuItem, BrnSetCustomSelectionParams customHandleCallBack) { /// 用户操作一段时间之后,将自定义参数回传,触发 onSelectionChanged回调。 BrnDialogManager.showConfirmDialog(context, - cancel: '取消', confirm: '确定', message: '点击确定,回传自定义参数到筛选', onConfirm: () { + cancel: '取消', + confirm: '确定', + message: '点击确定,回传自定义参数到筛选', onConfirm: () { count++; customHandleCallBack({"CKey": "CValue" + '$count'}); }, onCancel: () {}); @@ -44,8 +47,11 @@ class _SelectionViewExamplePageState extends State _SelectionViewExamplePageState(_filters); + _SelectionViewExamplePageState createState() => + _SelectionViewExamplePageState(_filters); } -class _SelectionViewExamplePageState extends State { +class _SelectionViewExamplePageState + extends State { List? _filterData; var selectionKey = GlobalKey(); @@ -24,7 +24,8 @@ class _SelectionViewExamplePageState extends State customParams, BrnSetCustomSelectionMenuTitle setCustomTitleFunction) { BrnToast.show( - 'filterParams : $filterParams' + ',\n customParams : $customParams', context); + 'filterParams : $filterParams' + + ',\n customParams : $customParams', + context); _filterSelectedDate = customParams['date']; if (customParams.isNotEmpty) { - setCustomTitleFunction(menuTitle: customParams.values.first, isMenuTitleHighLight: true); + setCustomTitleFunction( + menuTitle: customParams.values.first, + isMenuTitleHighLight: true); } else { - setCustomTitleFunction(menuTitle: '自定义事件选择', isMenuTitleHighLight: false); + setCustomTitleFunction( + menuTitle: '自定义事件选择', isMenuTitleHighLight: false); } }, ), @@ -96,16 +104,20 @@ class _SelectionViewExamplePageState extends State[BrnSelectionAnimationWidget(controller: controller, view: content)], + children: [ + BrnSelectionAnimationWidget(controller: controller, view: content) + ], ), ), ); @@ -166,7 +180,8 @@ class _SelectionViewExamplePageState extends State() - : {'date': _currentCalendarSelectedDate.value.toString()}); - _filterSelectedDate = _currentCalendarSelectedDate.value?.toString(); + : { + 'date': _currentCalendarSelectedDate.value.toString() + }); + _filterSelectedDate = + _currentCalendarSelectedDate.value?.toString(); closeCustomFilterView(); }, title: '确定', diff --git a/example/lib/sample/components/selection/selectionview_date_filter_example_page.dart b/example/lib/sample/components/selection/selectionview_date_filter_example_page.dart index 73f08375..6402c166 100644 --- a/example/lib/sample/components/selection/selectionview_date_filter_example_page.dart +++ b/example/lib/sample/components/selection/selectionview_date_filter_example_page.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -10,10 +8,12 @@ class SelectionViewDateFilterExamplePage extends StatefulWidget { SelectionViewDateFilterExamplePage(this._title, this._filters); @override - _SelectionViewExamplePageState createState() => _SelectionViewExamplePageState(_filters); + _SelectionViewExamplePageState createState() => + _SelectionViewExamplePageState(_filters); } -class _SelectionViewExamplePageState extends State { +class _SelectionViewExamplePageState + extends State { late List _filterData; _SelectionViewExamplePageState(List filters) { @@ -28,19 +28,24 @@ class _SelectionViewExamplePageState extends State[ BrnSelectionView( originalSelectionData: _filterData, - onCustomSelectionMenuClick: (int index, BrnSelectionEntity customMenuItem, + onCustomSelectionMenuClick: (int index, + BrnSelectionEntity customMenuItem, BrnSetCustomSelectionParams customHandleCallBack) { customHandleCallBack({"customKey": "customValue"}); }, - onMoreSelectionMenuClick: (int index, BrnOpenMorePage openMorePage) { - openMorePage(updateData: false, moreSelections: widget._filters); + onMoreSelectionMenuClick: + (int index, BrnOpenMorePage openMorePage) { + openMorePage( + updateData: false, moreSelections: widget._filters); }, onSelectionChanged: (int menuIndex, Map filterParams, Map customParams, BrnSetCustomSelectionMenuTitle setCustomTitleFunction) { BrnToast.show( - 'filterParams : $filterParams' + ',\n customParams : $customParams', context); + 'filterParams : $filterParams' + + ',\n customParams : $customParams', + context); }, ), Container( diff --git a/example/lib/sample/components/selection/selectionview_date_range_example_page.dart b/example/lib/sample/components/selection/selectionview_date_range_example_page.dart index 25979345..8366c525 100644 --- a/example/lib/sample/components/selection/selectionview_date_range_example_page.dart +++ b/example/lib/sample/components/selection/selectionview_date_range_example_page.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -10,10 +8,12 @@ class SelectionViewDateRangeExamplePage extends StatefulWidget { SelectionViewDateRangeExamplePage(this._title, this._filterData); @override - _SelectionViewExamplePageState createState() => _SelectionViewExamplePageState(); + _SelectionViewExamplePageState createState() => + _SelectionViewExamplePageState(); } -class _SelectionViewExamplePageState extends State { +class _SelectionViewExamplePageState + extends State { List? items; BrnSelectionViewController? controller; diff --git a/example/lib/sample/components/selection/selectionview_interceptor_example.dart b/example/lib/sample/components/selection/selectionview_interceptor_example.dart index 6edb7e21..07899418 100644 --- a/example/lib/sample/components/selection/selectionview_interceptor_example.dart +++ b/example/lib/sample/components/selection/selectionview_interceptor_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -10,10 +8,12 @@ class SelectionViewCloseOrInterceptorExamplePage extends StatefulWidget { SelectionViewCloseOrInterceptorExamplePage(this._title, this._filterData); @override - _SelectionViewExamplePageState createState() => _SelectionViewExamplePageState(); + _SelectionViewExamplePageState createState() => + _SelectionViewExamplePageState(); } -class _SelectionViewExamplePageState extends State { +class _SelectionViewExamplePageState + extends State { List? items; BrnSelectionViewController? controller; diff --git a/example/lib/sample/components/selection/selectionview_limit_max_selected_count_example.dart b/example/lib/sample/components/selection/selectionview_limit_max_selected_count_example.dart index acf53e3a..2a8a7ca3 100644 --- a/example/lib/sample/components/selection/selectionview_limit_max_selected_count_example.dart +++ b/example/lib/sample/components/selection/selectionview_limit_max_selected_count_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -10,10 +8,12 @@ class SelectionViewLimitMaxSelectedCountExamplePage extends StatefulWidget { SelectionViewLimitMaxSelectedCountExamplePage(this._title, this._filterData); @override - _SelectionViewExamplePageState createState() => _SelectionViewExamplePageState(); + _SelectionViewExamplePageState createState() => + _SelectionViewExamplePageState(); } -class _SelectionViewExamplePageState extends State { +class _SelectionViewExamplePageState + extends State { List? items; BrnSelectionViewController? controller; @@ -55,7 +55,9 @@ class _SelectionViewExamplePageState extends State customParams, BrnSetCustomSelectionMenuTitle setCustomTitleFunction) { BrnToast.show( - 'filterParams : $filterParams' + ',\n customParams : $customParams', context); + 'filterParams : $filterParams' + + ',\n customParams : $customParams', + context); }, onMenuClickInterceptor: (index) { if (index == 4) { diff --git a/example/lib/sample/components/selection/selectionview_more_filter_example_page.dart b/example/lib/sample/components/selection/selectionview_more_filter_example_page.dart index a5c5f79d..80dce9dc 100644 --- a/example/lib/sample/components/selection/selectionview_more_filter_example_page.dart +++ b/example/lib/sample/components/selection/selectionview_more_filter_example_page.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -10,10 +8,12 @@ class SelectionViewMoreFilterExamplePage extends StatefulWidget { SelectionViewMoreFilterExamplePage(this._title, this._filters); @override - _SelectionViewExamplePageState createState() => _SelectionViewExamplePageState(); + _SelectionViewExamplePageState createState() => + _SelectionViewExamplePageState(); } -class _SelectionViewExamplePageState extends State { +class _SelectionViewExamplePageState + extends State { int count = 0; @override diff --git a/example/lib/sample/components/selection/selectionview_multi_list_example_page.dart b/example/lib/sample/components/selection/selectionview_multi_list_example_page.dart index bb5937fa..931ad873 100644 --- a/example/lib/sample/components/selection/selectionview_multi_list_example_page.dart +++ b/example/lib/sample/components/selection/selectionview_multi_list_example_page.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -10,10 +8,12 @@ class SelectionViewMultiListExamplePage extends StatefulWidget { SelectionViewMultiListExamplePage(this._title, this._filterData); @override - _SelectionViewExamplePageState createState() => _SelectionViewExamplePageState(); + _SelectionViewExamplePageState createState() => + _SelectionViewExamplePageState(); } -class _SelectionViewExamplePageState extends State { +class _SelectionViewExamplePageState + extends State { List? items; @override diff --git a/example/lib/sample/components/selection/selectionview_multi_range_example_page.dart b/example/lib/sample/components/selection/selectionview_multi_range_example_page.dart index f9594e28..83992978 100644 --- a/example/lib/sample/components/selection/selectionview_multi_range_example_page.dart +++ b/example/lib/sample/components/selection/selectionview_multi_range_example_page.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -10,10 +8,12 @@ class SelectionViewMultiRangeExamplePage extends StatefulWidget { SelectionViewMultiRangeExamplePage(this._title, this._filters); @override - _SelectionViewExamplePageState createState() => _SelectionViewExamplePageState(); + _SelectionViewExamplePageState createState() => + _SelectionViewExamplePageState(); } -class _SelectionViewExamplePageState extends State { +class _SelectionViewExamplePageState + extends State { List? titles; @override @@ -36,7 +36,8 @@ class _SelectionViewExamplePageState extends State _SelectionViewExamplePageState(); + _SelectionViewExamplePageState createState() => + _SelectionViewExamplePageState(); } -class _SelectionViewExamplePageState extends State { +class _SelectionViewExamplePageState + extends State { List? items; @override @@ -34,9 +34,10 @@ class _SelectionViewExamplePageState extends State filterParams) { - BrnToast.show(filterParams.map((e) => e.value).toList().join(','), context); + onSimpleSelectionChanged: (List filterParams) { + BrnToast.show( + filterParams.map((e) => e.value).toList().join(','), + context); }, ), Container( diff --git a/example/lib/sample/components/selection/selectionview_simple_single_list_example_page.dart b/example/lib/sample/components/selection/selectionview_simple_single_list_example_page.dart index 3ef33f9e..862908bb 100755 --- a/example/lib/sample/components/selection/selectionview_simple_single_list_example_page.dart +++ b/example/lib/sample/components/selection/selectionview_simple_single_list_example_page.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:example/sample/components/selection/filter_entity.dart'; import 'package:flutter/material.dart'; @@ -11,10 +9,12 @@ class SelectionViewSimpleSingleListExamplePage extends StatefulWidget { SelectionViewSimpleSingleListExamplePage(this._title, this._filterData); @override - _SelectionViewExamplePageState createState() => _SelectionViewExamplePageState(); + _SelectionViewExamplePageState createState() => + _SelectionViewExamplePageState(); } -class _SelectionViewExamplePageState extends State { +class _SelectionViewExamplePageState + extends State { List? items; @override @@ -33,9 +33,10 @@ class _SelectionViewExamplePageState extends State filterParams) { - BrnToast.show(filterParams.map((e) => e.value).toList().join(','), context); + onSimpleSelectionChanged: (List filterParams) { + BrnToast.show( + filterParams.map((e) => e.value).toList().join(','), + context); }, ), Container( diff --git a/example/lib/sample/components/step/brn_horizontal_step_example.dart b/example/lib/sample/components/step/brn_horizontal_step_example.dart index f65c31de..ace31359 100644 --- a/example/lib/sample/components/step/brn_horizontal_step_example.dart +++ b/example/lib/sample/components/step/brn_horizontal_step_example.dart @@ -134,7 +134,8 @@ class SliverBrnHorizontalStep extends StatefulWidget { final ValueNotifier valueNotifier; @override - _SliverBrnHorizontalStepsState createState() => _SliverBrnHorizontalStepsState(); + _SliverBrnHorizontalStepsState createState() => + _SliverBrnHorizontalStepsState(); } class _SliverBrnHorizontalStepsState extends State { diff --git a/example/lib/sample/components/step/step_example.dart b/example/lib/sample/components/step/step_example.dart index 9d493417..8deaf0ca 100644 --- a/example/lib/sample/components/step/step_example.dart +++ b/example/lib/sample/components/step/step_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:example/sample/components/step/brn_horizontal_step_example.dart'; import 'package:example/sample/components/step/step_line_example.dart'; @@ -8,36 +6,39 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class StepExample extends StatelessWidget { - @override Widget build(BuildContext context) { return Scaffold( appBar: BrnAppBar( title: "步骤条示例", - ),body: ListView(children: [ - ListItem( - title: "横向步骤条", - isShowLine: false, - describe: "显示流程阶段,告知用户'我在哪/我能去哪',跟随主题色", - onPressed: () { - Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) { - return BrnHorizontalStepExamplePage(title: "步骤条"); - }, - )); - }, ), - ListItem( - title: "竖向步骤条", - describe: '显示步骤、时间线', - onPressed: () { - Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) { - return StepLineExample(); + body: ListView( + children: [ + ListItem( + title: "横向步骤条", + isShowLine: false, + describe: "显示流程阶段,告知用户'我在哪/我能去哪',跟随主题色", + onPressed: () { + Navigator.push(context, MaterialPageRoute( + builder: (BuildContext context) { + return BrnHorizontalStepExamplePage(title: "步骤条"); + }, + )); + }, + ), + ListItem( + title: "竖向步骤条", + describe: '显示步骤、时间线', + onPressed: () { + Navigator.push(context, MaterialPageRoute( + builder: (BuildContext context) { + return StepLineExample(); + }, + )); }, - )); - }, + ), + ], ), - ],),); + ); } } diff --git a/example/lib/sample/components/step/step_line_example.dart b/example/lib/sample/components/step/step_line_example.dart index cafad219..00fedb66 100644 --- a/example/lib/sample/components/step/step_line_example.dart +++ b/example/lib/sample/components/step/step_line_example.dart @@ -68,7 +68,7 @@ class _StepLineExampleState extends State { iconTopPadding: 20, //最后一个的线条为透明色 做到不显示的效果 lineColor: - index == 2 ? Colors.transparent : const Color(0xffeeeeee), + index == 2 ? Colors.transparent : const Color(0xffeeeeee), contentWidget: Container( padding: const EdgeInsets.only(left: 8), child: Column( @@ -187,20 +187,20 @@ class _StepLineExampleState extends State { lineColor: index == 2 ? Colors.transparent : (index == 1 - ? [ - BrnThemeConfigurator.instance - .getConfig() - .commonConfig - .brandPrimary, - Colors.red - ] - : null), + ? [ + BrnThemeConfigurator.instance + .getConfig() + .commonConfig + .brandPrimary, + Colors.red + ] + : null), highlightColor: index == 2 ? Colors.red : BrnThemeConfigurator.instance - .getConfig() - .commonConfig - .brandPrimary, + .getConfig() + .commonConfig + .brandPrimary, contentWidget: Container( padding: const EdgeInsets.only(left: 8), child: Column( @@ -377,9 +377,9 @@ class _StepLineExampleState extends State { dynamic getLineColor(int index) { return index == 1 ? [ - BrnThemeConfigurator.instance.getConfig().commonConfig.brandPrimary, - Colors.red - ] + BrnThemeConfigurator.instance.getConfig().commonConfig.brandPrimary, + Colors.red + ] : (index == 2 ? Colors.transparent : const Color(0xffeeeeee)); } diff --git a/example/lib/sample/components/sugsearch/search_text_example.dart b/example/lib/sample/components/sugsearch/search_text_example.dart index 1347faff..cd0a7779 100644 --- a/example/lib/sample/components/sugsearch/search_text_example.dart +++ b/example/lib/sample/components/sugsearch/search_text_example.dart @@ -1,4 +1,3 @@ - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -75,14 +74,15 @@ class _SearchTextExampleState extends State { Container( width: 200, child: BrnSearchText( - innerPadding: EdgeInsets.only(left: 20, right: 20, top: 10, bottom: 10), + innerPadding: + EdgeInsets.only(left: 20, right: 20, top: 10, bottom: 10), maxHeight: 60, innerColor: Colors.white, borderRadius: BorderRadius.all(Radius.circular(10)), - normalBorder: - Border.all(color: Color(0xFFF0F0F0), width: 1, style: BorderStyle.solid), - activeBorder: - Border.all(color: Color(0xFF0984F9), width: 1, style: BorderStyle.solid), + normalBorder: Border.all( + color: Color(0xFFF0F0F0), width: 1, style: BorderStyle.solid), + activeBorder: Border.all( + color: Color(0xFF0984F9), width: 1, style: BorderStyle.solid), onTextClear: () { debugPrint('sss'); focusNode.unfocus(); diff --git a/example/lib/sample/components/switch/checkbox_example.dart b/example/lib/sample/components/switch/checkbox_example.dart index d7ad41ba..8345f68b 100644 --- a/example/lib/sample/components/switch/checkbox_example.dart +++ b/example/lib/sample/components/switch/checkbox_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -9,7 +7,6 @@ class CheckboxExample extends StatefulWidget { } class _CheckboxExampleState extends State { - @override Widget build(BuildContext context) { return Scaffold( diff --git a/example/lib/sample/components/switch/radio_example.dart b/example/lib/sample/components/switch/radio_example.dart index 08fb1ce2..6c665189 100644 --- a/example/lib/sample/components/switch/radio_example.dart +++ b/example/lib/sample/components/switch/radio_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -26,7 +24,10 @@ class _RadioExampleState extends State { children: [ Text( '规则', - style: TextStyle(color: Color(0xFF222222), fontSize: 28, fontWeight: FontWeight.bold), + style: TextStyle( + color: Color(0xFF222222), + fontSize: 28, + fontWeight: FontWeight.bold), ), BrnBubbleText(maxLines: 2, text: '具备选中、未选中、以及禁用状态,支持设置左右widget'), Text( diff --git a/example/lib/sample/components/tabbar/brn_switch_title_example.dart b/example/lib/sample/components/tabbar/brn_switch_title_example.dart index 73658682..489ec409 100644 --- a/example/lib/sample/components/tabbar/brn_switch_title_example.dart +++ b/example/lib/sample/components/tabbar/brn_switch_title_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -8,7 +6,8 @@ class BrnSwitchTitleExample extends StatefulWidget { _BrnSwitchTitleExampleState createState() => _BrnSwitchTitleExampleState(); } -class _BrnSwitchTitleExampleState extends State with TickerProviderStateMixin { +class _BrnSwitchTitleExampleState extends State + with TickerProviderStateMixin { late TabController _controller; @override @@ -37,7 +36,10 @@ class _BrnSwitchTitleExampleState extends State with Tick children: [ Text( '规则', - style: TextStyle(color: Color(0xFF222222), fontSize: 28, fontWeight: FontWeight.bold), + style: TextStyle( + color: Color(0xFF222222), + fontSize: 28, + fontWeight: FontWeight.bold), ), BrnBubbleText( maxLines: 4, @@ -107,7 +109,14 @@ class _BrnSwitchTitleExampleState extends State with Tick ), ), BrnSwitchTitle( - nameList: ['标题内容1', '标题内容2', '标题内容3', '标题内容4', '标题内容5', '标题内容6'], + nameList: [ + '标题内容1', + '标题内容2', + '标题内容3', + '标题内容4', + '标题内容5', + '标题内容6' + ], defaultSelectIndex: 0, onSelect: (value) { BrnToast.show(value.toString(), context); diff --git a/example/lib/sample/components/tabbar/brn_tab_example.dart b/example/lib/sample/components/tabbar/brn_tab_example.dart index 7274978b..1511776b 100644 --- a/example/lib/sample/components/tabbar/brn_tab_example.dart +++ b/example/lib/sample/components/tabbar/brn_tab_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:example/sample/home/list_item.dart'; import 'package:flutter/material.dart'; @@ -11,7 +9,8 @@ class BrnTabExample extends StatefulWidget { _BrnTabExampleState createState() => _BrnTabExampleState(); } -class _BrnTabExampleState extends State with TickerProviderStateMixin { +class _BrnTabExampleState extends State + with TickerProviderStateMixin { BrnCloseWindowController? closeWindowController; @override @@ -39,7 +38,8 @@ class _BrnTabExampleState extends State with TickerProviderStateM Center( child: OutlinedButton( onPressed: () { - Navigator.of(context).push(new MaterialPageRoute(builder: (context) { + Navigator.of(context) + .push(new MaterialPageRoute(builder: (context) { return BrnTabbarStickyExample(); })); }, @@ -86,7 +86,8 @@ class _BrnTabExampleState extends State with TickerProviderStateM tabs.add(BadgeTab(text: "业务三")); tabs.add(BadgeTab(text: "业务四")); tabs.add(BadgeTab(text: "业务五")); - TabController tabController = TabController(length: tabs.length, vsync: this); + TabController tabController = + TabController(length: tabs.length, vsync: this); return BrnTabBar( controller: tabController, tabs: tabs, @@ -105,7 +106,8 @@ class _BrnTabExampleState extends State with TickerProviderStateM tabs.add(BadgeTab(text: "业务二")); tabs.add(BadgeTab(text: "业务三")); tabs.add(BadgeTab(text: "业务四")); - TabController tabController = TabController(length: tabs.length, vsync: this); + TabController tabController = + TabController(length: tabs.length, vsync: this); return BrnTabBar( controller: tabController, tabs: tabs, @@ -127,13 +129,13 @@ class _BrnTabExampleState extends State with TickerProviderStateM tabs.add(BadgeTab(text: "业务八", badgeNum: 23)); tabs.add(BadgeTab(text: "业务九")); TabController tabController = - TabController(length: tabs.length, vsync: this); + TabController(length: tabs.length, vsync: this); return BrnTabBar( controller: tabController, tabs: tabs, mode: BrnTabBarBadgeMode.origin, isScroll: false, - labelPadding: EdgeInsets.only(left:20,right: 12), + labelPadding: EdgeInsets.only(left: 20, right: 12), indicatorPadding: EdgeInsets.only(left: 10), onTap: (state, index) { BrnToast.show("点击了", context); @@ -152,7 +154,8 @@ class _BrnTabExampleState extends State with TickerProviderStateM tabs.add(BadgeTab(text: "业务七")); tabs.add(BadgeTab(text: "业务八", badgeNum: 23)); tabs.add(BadgeTab(text: "业务九", badgeNum: 43)); - TabController tabController = TabController(length: tabs.length, vsync: this); + TabController tabController = + TabController(length: tabs.length, vsync: this); return BrnTabBar( controller: tabController, tabs: tabs, @@ -168,7 +171,8 @@ class _BrnTabExampleState extends State with TickerProviderStateM tabs.add(BadgeTab(text: "业务二", badgeNum: 22)); tabs.add(BadgeTab(text: "业务三", badgeNum: 11)); tabs.add(BadgeTab(text: "业务四")); - TabController tabController = TabController(length: tabs.length, vsync: this); + TabController tabController = + TabController(length: tabs.length, vsync: this); return BrnTabBar( controller: tabController, tabs: tabs, @@ -185,7 +189,8 @@ class _BrnTabExampleState extends State with TickerProviderStateM tabs.add(BadgeTab(text: "业务三", topText: "3")); tabs.add(BadgeTab(text: "业务四", topText: "4")); tabs.add(BadgeTab(text: "业务五", topText: "5")); - TabController tabController = TabController(length: tabs.length, vsync: this); + TabController tabController = + TabController(length: tabs.length, vsync: this); return BrnTabBar( controller: tabController, tabs: tabs, @@ -203,7 +208,8 @@ class _BrnTabExampleState extends State with TickerProviderStateM tabs.add(BadgeTab(text: "业务一", badgeNum: 2)); tabs.add(BadgeTab(text: "业务二")); tabs.add(BadgeTab(text: "业务三", badgeNum: 33)); - TabController tabController = TabController(length: tabs.length, vsync: this); + TabController tabController = + TabController(length: tabs.length, vsync: this); return BrnTabBar( controller: tabController, tabs: tabs, @@ -221,7 +227,8 @@ class _BrnTabExampleState extends State with TickerProviderStateM tabs.add(BadgeTab(text: "08月11日", topText: "周三")); tabs.add(BadgeTab(text: "08月12日", topText: "周四")); tabs.add(BadgeTab(text: "08月13日", topText: "周五")); - TabController tabController = TabController(length: tabs.length, vsync: this); + TabController tabController = + TabController(length: tabs.length, vsync: this); return BrnTabBar( controller: tabController, tabs: tabs, @@ -238,7 +245,8 @@ class _BrnTabExampleState extends State with TickerProviderStateM tabs.add(BadgeTab(text: "08月09日", topText: "今天")); tabs.add(BadgeTab(text: "08月10日", topText: "明天")); tabs.add(BadgeTab(text: "08月11日", topText: "周三")); - TabController tabController = TabController(length: tabs.length, vsync: this); + TabController tabController = + TabController(length: tabs.length, vsync: this); return BrnTabBar( controller: tabController, tabs: tabs, @@ -261,7 +269,8 @@ class _BrnTabExampleState extends State with TickerProviderStateM tabs.add(BadgeTab(text: "业务七")); tabs.add(BadgeTab(text: "业务八", badgeNum: 23)); tabs.add(BadgeTab(text: "业务九")); - TabController tabController = TabController(length: tabs.length, vsync: this); + TabController tabController = + TabController(length: tabs.length, vsync: this); return BrnTabBar( controller: tabController, tabs: tabs, diff --git a/example/lib/sample/components/tabbar/brn_tabbar_sticky_example.dart b/example/lib/sample/components/tabbar/brn_tabbar_sticky_example.dart index 3b2ed8a6..2bb396df 100644 --- a/example/lib/sample/components/tabbar/brn_tabbar_sticky_example.dart +++ b/example/lib/sample/components/tabbar/brn_tabbar_sticky_example.dart @@ -42,11 +42,13 @@ class _BrnTabbarStickyExampleState extends State ), body: NestedScrollView( controller: scrollController, - headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { + headerSliverBuilder: + (BuildContext context, bool innerBoxIsScrolled) { return [ buildHeaderWidget(), SliverOverlapAbsorber( - handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), + handle: + NestedScrollView.sliverOverlapAbsorberHandleFor(context), sliver: SliverPersistentHeader( pinned: true, delegate: StickyTabBarDelegate( @@ -57,8 +59,10 @@ class _BrnTabbarStickyExampleState extends State moreWindowText: "Tabs描述", onTap: (state, index) { state.refreshBadgeState(index); - scrollController.animateTo(globalKey.currentContext!.size!.height, - duration: Duration(milliseconds: 200), curve: Curves.linear); + scrollController.animateTo( + globalKey.currentContext!.size!.height, + duration: Duration(milliseconds: 200), + curve: Curves.linear); }, onMorePop: () {}, closeController: closeWindowController, @@ -108,7 +112,8 @@ class StickyTabBarDelegate extends SliverPersistentHeaderDelegate { StickyTabBarDelegate({required this.child}); @override - Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) { + Widget build( + BuildContext context, double shrinkOffset, bool overlapsContent) { return this.child; } diff --git a/example/lib/sample/components/tabbar/sub_switch_title_example.dart b/example/lib/sample/components/tabbar/sub_switch_title_example.dart index 83ee38b7..0b0afa6a 100644 --- a/example/lib/sample/components/tabbar/sub_switch_title_example.dart +++ b/example/lib/sample/components/tabbar/sub_switch_title_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -38,7 +36,10 @@ class _SubSwitchTitleExampleState extends State children: [ Text( '规则', - style: TextStyle(color: Color(0xFF222222), fontSize: 28, fontWeight: FontWeight.bold), + style: TextStyle( + color: Color(0xFF222222), + fontSize: 28, + fontWeight: FontWeight.bold), ), BrnBubbleText( maxLines: 4, @@ -93,7 +94,14 @@ class _SubSwitchTitleExampleState extends State ), ), BrnSubSwitchTitle( - nameList: ['二级标题1', '二级标题2', '二级标题3', '二级标题4', '二级标题5', '二级标题6'], + nameList: [ + '二级标题1', + '二级标题2', + '二级标题3', + '二级标题4', + '二级标题5', + '二级标题6' + ], defaultSelectIndex: 0, onSelect: (value) { BrnToast.show(value.toString(), context); @@ -107,7 +115,14 @@ class _SubSwitchTitleExampleState extends State ), ), BrnSubSwitchTitle( - nameList: ['二级标题1', '二级标题2', '二级标题3', '二级标题4', '二级标题5', '二级标题6'], + nameList: [ + '二级标题1', + '二级标题2', + '二级标题3', + '二级标题4', + '二级标题5', + '二级标题6' + ], defaultSelectIndex: 0, controller: _controller, onSelect: (value) { diff --git a/example/lib/sample/components/tag/border_tag_example.dart b/example/lib/sample/components/tag/border_tag_example.dart index e37b580f..27cb4313 100644 --- a/example/lib/sample/components/tag/border_tag_example.dart +++ b/example/lib/sample/components/tag/border_tag_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -26,7 +24,10 @@ class _BorderTagExampleState extends State { children: [ Text( '规则', - style: TextStyle(color: Color(0xFF222222), fontSize: 28, fontWeight: FontWeight.bold), + style: TextStyle( + color: Color(0xFF222222), + fontSize: 28, + fontWeight: FontWeight.bold), ), BrnBubbleText(maxLines: 4, text: ' 文字大小 11,上下左右间距 3'), Text( diff --git a/example/lib/sample/components/tag/custom_tag_example.dart b/example/lib/sample/components/tag/custom_tag_example.dart index 8b5d425d..1948b926 100644 --- a/example/lib/sample/components/tag/custom_tag_example.dart +++ b/example/lib/sample/components/tag/custom_tag_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -23,9 +21,13 @@ class _CustomTagExampleState extends State { children: [ Text( '规则', - style: TextStyle(color: Color(0xFF222222), fontSize: 28, fontWeight: FontWeight.bold), + style: TextStyle( + color: Color(0xFF222222), + fontSize: 28, + fontWeight: FontWeight.bold), ), - BrnBubbleText(maxLines: 4, text: '标签的文字11号字,上下左右的边距是3,圆角是2,支持自定义的背景色和文字颜色'), + BrnBubbleText( + maxLines: 4, text: '标签的文字11号字,上下左右的边距是3,圆角是2,支持自定义的背景色和文字颜色'), Text( '正常案例', style: TextStyle( diff --git a/example/lib/sample/components/tag/select_tag_example.dart b/example/lib/sample/components/tag/select_tag_example.dart index 03122e59..4cb04c3d 100644 --- a/example/lib/sample/components/tag/select_tag_example.dart +++ b/example/lib/sample/components/tag/select_tag_example.dart @@ -1,11 +1,8 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; ///标签选择view class SelectTagExamplePage extends StatefulWidget { - @override State createState() => SelectTagExamplePageState(); } @@ -154,7 +151,9 @@ class SelectTagExamplePageState extends State { double _getTagWidth(context, {int rowCount: 4}) { double leftRightPadding = 40; double rowSpace = 12; - return (MediaQuery.of(context).size.width - leftRightPadding - rowSpace * (rowCount - 1)) / + return (MediaQuery.of(context).size.width - + leftRightPadding - + rowSpace * (rowCount - 1)) / rowCount; } } diff --git a/example/lib/sample/components/tag/state_tag_example.dart b/example/lib/sample/components/tag/state_tag_example.dart index 70b3facc..55738b38 100644 --- a/example/lib/sample/components/tag/state_tag_example.dart +++ b/example/lib/sample/components/tag/state_tag_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -23,7 +21,10 @@ class _StateTagExampleState extends State { children: [ Text( '规则', - style: TextStyle(color: Color(0xFF222222), fontSize: 28, fontWeight: FontWeight.bold), + style: TextStyle( + color: Color(0xFF222222), + fontSize: 28, + fontWeight: FontWeight.bold), ), BrnBubbleText(maxLines: 4, text: '同自定义标签'), Text( diff --git a/example/lib/sample/components/tag/tag_example.dart b/example/lib/sample/components/tag/tag_example.dart index c7222e94..a856bef0 100644 --- a/example/lib/sample/components/tag/tag_example.dart +++ b/example/lib/sample/components/tag/tag_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:example/sample/components/tag/border_tag_example.dart'; import 'package:example/sample/components/tag/custom_tag_example.dart'; @@ -11,83 +9,85 @@ import 'package:example/sample/home/list_item.dart'; import 'package:flutter/material.dart'; class TagExample extends StatelessWidget { - @override Widget build(BuildContext context) { return Scaffold( appBar: BrnAppBar( title: "标签示例", - ),body: ListView(children: [ - ListItem( - title: "选择标签", - isShowLine: false, - isSupportTheme: true, - describe: '可单选、多选标签', - onPressed: () { - Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) { - return SelectTagExamplePage(); - }, - )); - }, ), - ListItem( - title: "删除标签", - isSupportTheme: true, - describe: '可删除的标签', - onPressed: () { - Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) { - return DeleteTagExamplePage(); + body: ListView( + children: [ + ListItem( + title: "选择标签", + isShowLine: false, + isSupportTheme: true, + describe: '可单选、多选标签', + onPressed: () { + Navigator.push(context, MaterialPageRoute( + builder: (BuildContext context) { + return SelectTagExamplePage(); + }, + )); }, - )); - }, - ), - ListItem( - title: "自定义标签", - describe: 'key宽度最多92,value是左对齐', - onPressed: () { - Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) { - return CustomTagExample(); + ), + ListItem( + title: "删除标签", + isSupportTheme: true, + describe: '可删除的标签', + onPressed: () { + Navigator.push(context, MaterialPageRoute( + builder: (BuildContext context) { + return DeleteTagExamplePage(); + }, + )); }, - )); - }, - ), - ListItem( - title: "状态标签", - describe: '默认黄色,支持设置其他颜色', - onPressed: () { - Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) { - return StateTagExample(); + ), + ListItem( + title: "自定义标签", + describe: 'key宽度最多92,value是左对齐', + onPressed: () { + Navigator.push(context, MaterialPageRoute( + builder: (BuildContext context) { + return CustomTagExample(); + }, + )); }, - )); - }, - ), - ListItem( - title: "带边框颜色", - describe: '默认主题色,支持设置其他颜色', - onPressed: () { - Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) { - return BorderTagExample(); + ), + ListItem( + title: "状态标签", + describe: '默认黄色,支持设置其他颜色', + onPressed: () { + Navigator.push(context, MaterialPageRoute( + builder: (BuildContext context) { + return StateTagExample(); + }, + )); }, - )); - }, - ), - ListItem( - title: "标签组", - describe: '多个标签组合在一起标签', - onPressed: () { - Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) { - return RowTagExample(); + ), + ListItem( + title: "带边框颜色", + describe: '默认主题色,支持设置其他颜色', + onPressed: () { + Navigator.push(context, MaterialPageRoute( + builder: (BuildContext context) { + return BorderTagExample(); + }, + )); }, - )); - }, + ), + ListItem( + title: "标签组", + describe: '多个标签组合在一起标签', + onPressed: () { + Navigator.push(context, MaterialPageRoute( + builder: (BuildContext context) { + return RowTagExample(); + }, + )); + }, + ), + ], ), - - ],),); + ); } } diff --git a/example/lib/sample/components/tag/tag_row_example.dart b/example/lib/sample/components/tag/tag_row_example.dart index 510eec30..ed035494 100644 --- a/example/lib/sample/components/tag/tag_row_example.dart +++ b/example/lib/sample/components/tag/tag_row_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/toast/toast_example.dart b/example/lib/sample/components/toast/toast_example.dart index 50821aff..113e9af5 100644 --- a/example/lib/sample/components/toast/toast_example.dart +++ b/example/lib/sample/components/toast/toast_example.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -64,13 +62,10 @@ class _ToastExampleState extends State ), ElevatedButton( onPressed: () { - BrnToast.show( - "自定义位置Toast", - context, + BrnToast.show("自定义位置Toast", context, duration: BrnDuration.short, verticalOffset: 100, - gravity: BrnToastGravity.bottom - ); + gravity: BrnToastGravity.bottom); }, child: Text("自定义位置Toast"), ), diff --git a/example/lib/sample/home/card_data_config.dart b/example/lib/sample/home/card_data_config.dart index 64bf5baf..09498288 100644 --- a/example/lib/sample/home/card_data_config.dart +++ b/example/lib/sample/home/card_data_config.dart @@ -1,5 +1,3 @@ - - import 'dart:convert'; import 'package:bruno/bruno.dart'; @@ -101,9 +99,9 @@ class CardDataConfig { desc: "数据折线图", navigatorPage: (BuildContext context) { rootBundle.loadString('assets/brokenline_data.json').then((data) { - var brokenData = [] - ..addAll(((JsonDecoder().convert(data) as List?) ?? []) - .map((o) => DBDataNodeModel.fromJson(o))); + var brokenData = []..addAll( + ((JsonDecoder().convert(data) as List?) ?? []) + .map((o) => DBDataNodeModel.fromJson(o))); Navigator.push(context, MaterialPageRoute( builder: (BuildContext context) { return BrokenLineExample(brokenData); @@ -428,7 +426,7 @@ class CardDataConfig { /// 内容 static GroupInfo _getContentGroup() { - List children =[]; + List children = []; children.add(GroupInfo( groupName: "Tag 标签", desc: "标签多种样式", diff --git a/example/lib/sample/home/expandable_container_widget.dart b/example/lib/sample/home/expandable_container_widget.dart index d8264175..4013d6d9 100644 --- a/example/lib/sample/home/expandable_container_widget.dart +++ b/example/lib/sample/home/expandable_container_widget.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - - import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; @@ -36,7 +34,7 @@ class BrnExpandableContainerWidget extends StatefulWidget { this.initiallyExpanded = false, this.animationDuration, this.expandableController, - }) : super(key: key); + }) : super(key: key); /// A widget to display before the title. /// @@ -61,12 +59,15 @@ class BrnExpandableContainerWidget extends StatefulWidget { final BrnExpandableContainerController? expandableController; @override - _BrnExpansionContainerElementState createState() => _BrnExpansionContainerElementState(); + _BrnExpansionContainerElementState createState() => + _BrnExpansionContainerElementState(); } -class _BrnExpansionContainerElementState extends State +class _BrnExpansionContainerElementState + extends State with SingleTickerProviderStateMixin { - static final Animatable _easeInTween = CurveTween(curve: Curves.easeIn); + static final Animatable _easeInTween = + CurveTween(curve: Curves.easeIn); BrnExpandableContainerController? _expandableController; AnimationController? _animationController; @@ -79,13 +80,16 @@ class _BrnExpansionContainerElementState extends State with SingleTickerProviderStateMixin { - static final Animatable _easeInTween = CurveTween(curve: Curves.easeIn); - static final Animatable _halfTween = Tween(begin: 0.0, end: 0.5); +class GroupCardState extends State + with SingleTickerProviderStateMixin { + static final Animatable _easeInTween = + CurveTween(curve: Curves.easeIn); + static final Animatable _halfTween = + Tween(begin: 0.0, end: 0.5); BrnExpandableContainerController? _controller; Widget? _arrowIcon; late Animation _iconTurns; @@ -33,7 +34,8 @@ class GroupCardState extends State with SingleTickerProviderStateMixi void initState() { super.initState(); _controller = BrnExpandableContainerController(); - _animationController = AnimationController(duration: Duration(milliseconds: 200), vsync: this); + _animationController = + AnimationController(duration: Duration(milliseconds: 200), vsync: this); _initExpand = widget.groupInfo!.isExpand; _iconTurns = _animationController!.drive(_halfTween.chain(_easeInTween)); if (_initExpand) { @@ -55,7 +57,7 @@ class GroupCardState extends State with SingleTickerProviderStateMixi return BrnPickerClipRRect( borderRadius: BorderRadius.all(Radius.circular(6)), child: BrnExpandableContainerWidget( - key: widget.key, + key: widget.key, expandableController: _controller, initiallyExpanded: _initExpand, onExpansionChanged: (isExpand) { @@ -96,7 +98,7 @@ class GroupCardState extends State with SingleTickerProviderStateMixi } Widget _getContentWidget() { - if(widget.groupInfo == null || widget.groupInfo!.children == null){ + if (widget.groupInfo == null || widget.groupInfo!.children == null) { return SizedBox.shrink(); } return ListView.builder( @@ -107,7 +109,8 @@ class GroupCardState extends State with SingleTickerProviderStateMixi return Container( color: Colors.white, child: ListItem( - isSupportTheme: widget.groupInfo?.children![index].isSupportTheme ?? false, + isSupportTheme: + widget.groupInfo?.children![index].isSupportTheme ?? false, isShowLine: !(index == 0), title: widget.groupInfo?.children![index].groupName ?? '', describe: widget.groupInfo?.children![index].desc ?? '', diff --git a/example/lib/sample/home/home.dart b/example/lib/sample/home/home.dart index cf745500..d9654146 100644 --- a/example/lib/sample/home/home.dart +++ b/example/lib/sample/home/home.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:example/sample/home/card_data_config.dart'; import 'package:example/sample/home/group_card.dart'; diff --git a/example/lib/sample/theme/config_test_utils.dart b/example/lib/sample/theme/config_test_utils.dart index a9256ce8..e2373a85 100644 --- a/example/lib/sample/theme/config_test_utils.dart +++ b/example/lib/sample/theme/config_test_utils.dart @@ -1,5 +1,3 @@ - - import 'dart:ui'; import 'package:bruno/bruno.dart'; @@ -7,8 +5,8 @@ import 'package:flutter/material.dart'; class TestConfigUtils { /// 默认全局配置 - static BrnAllThemeConfig defaultAllConfig = - BrnAllThemeConfig(commonConfig: defaultCommonConfig, dialogConfig: defaultDialogConfig); + static BrnAllThemeConfig defaultAllConfig = BrnAllThemeConfig( + commonConfig: defaultCommonConfig, dialogConfig: defaultDialogConfig); /// 全局默认配置 static BrnCommonConfig defaultCommonConfig = BrnCommonConfig( @@ -158,8 +156,10 @@ class TestConfigUtils { leftAndRightPadding: 24, itemSpacing: 24, titleMaxLength: 20, - titleStyle: BrnTextStyle(color: Color(0xff222222), fontWeight: FontWeight.w600, fontSize: 24), - actionsStyle: BrnTextStyle(color: Color(0xFF3072F6), fontWeight: FontWeight.w600, fontSize: 18), + titleStyle: BrnTextStyle( + color: Color(0xff222222), fontWeight: FontWeight.w600, fontSize: 24), + actionsStyle: BrnTextStyle( + color: Color(0xFF3072F6), fontWeight: FontWeight.w600, fontSize: 18), ); static BrnButtonConfig defaultButtonConfig = BrnButtonConfig( @@ -170,17 +170,19 @@ class TestConfigUtils { smallButtonFontSize: 14, smallButtonHeight: 36); - static BrnPairInfoTableConfig defaultPairInfoTableConfig = BrnPairInfoTableConfig( - rowSpacing: 6, - itemSpacing: 8, - valueTextStyle: BrnTextStyle(fontSize: 16), - keyTextStyle: BrnTextStyle(fontSize: 16), - linkTextStyle: BrnTextStyle(fontSize: 16)); - - static BrnPairRichInfoGridConfig defaultPairRichInfoGridConfig = BrnPairRichInfoGridConfig( - rowSpacing: 6, - itemSpacing: 4, - valueTextStyle: BrnTextStyle(fontSize: 16), - keyTextStyle: BrnTextStyle(fontSize: 16), - linkTextStyle: BrnTextStyle(fontSize: 16)); + static BrnPairInfoTableConfig defaultPairInfoTableConfig = + BrnPairInfoTableConfig( + rowSpacing: 6, + itemSpacing: 8, + valueTextStyle: BrnTextStyle(fontSize: 16), + keyTextStyle: BrnTextStyle(fontSize: 16), + linkTextStyle: BrnTextStyle(fontSize: 16)); + + static BrnPairRichInfoGridConfig defaultPairRichInfoGridConfig = + BrnPairRichInfoGridConfig( + rowSpacing: 6, + itemSpacing: 4, + valueTextStyle: BrnTextStyle(fontSize: 16), + keyTextStyle: BrnTextStyle(fontSize: 16), + linkTextStyle: BrnTextStyle(fontSize: 16)); } diff --git a/lib/src/components/actionsheet/brn_selected_list_action_sheet.dart b/lib/src/components/actionsheet/brn_selected_list_action_sheet.dart index df501aaa..caa7eff7 100644 --- a/lib/src/components/actionsheet/brn_selected_list_action_sheet.dart +++ b/lib/src/components/actionsheet/brn_selected_list_action_sheet.dart @@ -286,20 +286,21 @@ class _BrnActionSheetSelectedItemListState AnimationController alphaAnimationController = AnimationController( duration: const Duration(milliseconds: 200), vsync: this); widget._alphaAnimationController = alphaAnimationController; - Animation yAnimation = Tween(begin: 65.0, end: this.getContentHeight()) - .animate(yAnimationController) - ..addListener(() { - setState(() => {}); - }) - ..addStatusListener((status) { - if (status == AnimationStatus.dismissed) { - widget.onDismiss!(_isClosedByClear); - } - }); + Animation yAnimation = + Tween(begin: 65.0, end: this.getContentHeight()) + .animate(yAnimationController) + ..addListener(() { + setState(() => {}); + }) + ..addStatusListener((status) { + if (status == AnimationStatus.dismissed) { + widget.onDismiss!(_isClosedByClear); + } + }); widget._yAnimation = yAnimation; Animation alphaAnimation = Tween(begin: 0.0, end: 0.7) .animate(alphaAnimationController) - ..addListener(() {}); + ..addListener(() {}); widget._alphaAnimation = alphaAnimation as Animation; yAnimationController.forward(); alphaAnimationController.forward(); diff --git a/lib/src/components/appraise/brn_appraise_header.dart b/lib/src/components/appraise/brn_appraise_header.dart index 252a0344..6ba5a3b8 100644 --- a/lib/src/components/appraise/brn_appraise_header.dart +++ b/lib/src/components/appraise/brn_appraise_header.dart @@ -33,7 +33,8 @@ class BrnAppraiseHeader extends StatelessWidget { this.maxLines = 1, this.headerType = BrnAppraiseHeaderType.spaceBetween, this.headPadding, - this.cancelCallBack}) : super(key: key); + this.cancelCallBack}) + : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/src/components/appraise/brn_appraise_interface.dart b/lib/src/components/appraise/brn_appraise_interface.dart index f3b70cb2..9ca62991 100644 --- a/lib/src/components/appraise/brn_appraise_interface.dart +++ b/lib/src/components/appraise/brn_appraise_interface.dart @@ -16,4 +16,4 @@ typedef BrnAppraiseConfirmClick = void Function( int index, List selectedTags, String input); /// 点击关闭的回掉 -typedef BrnAppraiseCloseClickCallBack = void Function(BuildContext context); \ No newline at end of file +typedef BrnAppraiseCloseClickCallBack = void Function(BuildContext context); diff --git a/lib/src/components/calendar/brn_calendar_view.dart b/lib/src/components/calendar/brn_calendar_view.dart index 3f5feb97..0607d263 100644 --- a/lib/src/components/calendar/brn_calendar_view.dart +++ b/lib/src/components/calendar/brn_calendar_view.dart @@ -36,9 +36,8 @@ class BrnCalendarView extends StatefulWidget { this.minDate, this.maxDate}) : assert(weekNames.length == 7), - assert( - selectMode == SelectMode.single && dateChange != null || - selectMode == SelectMode.range && rangeDateChange != null), + assert(selectMode == SelectMode.single && dateChange != null || + selectMode == SelectMode.range && rangeDateChange != null), super(key: key); const BrnCalendarView.single( @@ -625,7 +624,6 @@ class _CustomCalendarViewState extends State { } catch (_) {} }); } - } String _getChinaWeekName(int weekOfDay) { diff --git a/lib/src/components/card/bubble_card/brn_bubble_text.dart b/lib/src/components/card/bubble_card/brn_bubble_text.dart index e5161c5b..f1c33731 100644 --- a/lib/src/components/card/bubble_card/brn_bubble_text.dart +++ b/lib/src/components/card/bubble_card/brn_bubble_text.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/src/components/text/brn_expandable_text.dart'; import 'package:bruno/src/theme/brn_theme_configurator.dart'; import 'package:flutter/material.dart'; @@ -48,8 +46,6 @@ class BrnBubbleText extends StatelessWidget { /// 内容文本样式 final TextStyle? textStyle; - - const BrnBubbleText( {Key? key, this.text = '', diff --git a/lib/src/components/card/bubble_card/brn_insert_info.dart b/lib/src/components/card/bubble_card/brn_insert_info.dart index a1872aa4..cb0ec4c0 100644 --- a/lib/src/components/card/bubble_card/brn_insert_info.dart +++ b/lib/src/components/card/bubble_card/brn_insert_info.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/src/theme/brn_theme_configurator.dart'; import 'package:bruno/src/utils/brn_tools.dart'; import 'package:flutter/material.dart'; diff --git a/lib/src/components/card/content_card/brn_enhance_number_card.dart b/lib/src/components/card/content_card/brn_enhance_number_card.dart index 12f683f7..13d765bc 100644 --- a/lib/src/components/card/content_card/brn_enhance_number_card.dart +++ b/lib/src/components/card/content_card/brn_enhance_number_card.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/src/constants/brn_asset_constants.dart'; import 'package:bruno/src/constants/brn_strings_constants.dart'; import 'package:bruno/src/theme/brn_theme.dart'; @@ -248,8 +246,7 @@ class BrnEnhanceNumberCard extends StatelessWidget { overflow: TextOverflow.ellipsis, ); if (model.iconTapCallBack != null) { - Widget icon = - BrunoTools.getAssetSizeImage(BrnAsset.iconQuestion, 14, 14); + Widget icon = BrunoTools.getAssetSizeImage(BrnAsset.iconQuestion, 14, 14); if (model.numberInfoIcon == BrnNumberInfoIcon.arrow) { icon = BrunoTools.getAssetSizeImage(BrnAsset.iconRightArrow, 14, 14); diff --git a/lib/src/components/card/content_card/brn_pair_info_rich_grid.dart b/lib/src/components/card/content_card/brn_pair_info_rich_grid.dart index ca1f2666..1ee1bfea 100644 --- a/lib/src/components/card/content_card/brn_pair_info_rich_grid.dart +++ b/lib/src/components/card/content_card/brn_pair_info_rich_grid.dart @@ -1,5 +1,3 @@ - - import 'dart:ui' as ui; import 'package:bruno/src/constants/brn_asset_constants.dart'; @@ -128,7 +126,8 @@ class BrnRichInfoGrid extends StatelessWidget { ], ); }, - itemCount: (null != this.pairInfoList) ? this.pairInfoList!.length : 0, + itemCount: + (null != this.pairInfoList) ? this.pairInfoList!.length : 0, ); return gridView; }, diff --git a/lib/src/components/charts/brn_progress_bar_chart/brn_bar_chart_data.dart b/lib/src/components/charts/brn_progress_bar_chart/brn_bar_chart_data.dart index 5cd4d015..47498ee6 100644 --- a/lib/src/components/charts/brn_progress_bar_chart/brn_bar_chart_data.dart +++ b/lib/src/components/charts/brn_progress_bar_chart/brn_bar_chart_data.dart @@ -89,6 +89,7 @@ class BrnBarBean { ///用户当前进行位置的小图标(比如一个小锁),默认没有只显示y轴的值,如果有内容则显示这个小图标, ui.Image? placehoderImage; + BrnBarBean( {this.name, this.xTitleStyle, diff --git a/lib/src/components/charts/brn_progress_bar_chart/brn_progress_bar_chart_painter.dart b/lib/src/components/charts/brn_progress_bar_chart/brn_progress_bar_chart_painter.dart index 912efe4f..e5d0e673 100644 --- a/lib/src/components/charts/brn_progress_bar_chart/brn_progress_bar_chart_painter.dart +++ b/lib/src/components/charts/brn_progress_bar_chart/brn_progress_bar_chart_painter.dart @@ -47,6 +47,7 @@ class AxisItem { /// 文本大小 late Size textSize; + AxisItem({required this.showText}); } @@ -105,6 +106,7 @@ class BrnProgressBarItem { Rect? barRect; Rect? barHintRect; late Offset barGroupAxisCenter; + BrnProgressBarItem( {this.text, required this.value, @@ -123,6 +125,7 @@ class BrnProgressBarBundle { final List barList; final List colors; final List hintColors; + BrnProgressBarBundle( {required this.barList, this.colors = _defaultColor, diff --git a/lib/src/components/charts/brn_progress_chart/brn_progress_chart.dart b/lib/src/components/charts/brn_progress_chart/brn_progress_chart.dart index 30a27266..cd15e8f1 100644 --- a/lib/src/components/charts/brn_progress_chart/brn_progress_chart.dart +++ b/lib/src/components/charts/brn_progress_chart/brn_progress_chart.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/src/components/charts/brn_progress_chart/brn_progress_chart_painter.dart'; import 'package:flutter/material.dart'; diff --git a/lib/src/components/charts/brn_progress_chart/brn_progress_chart_painter.dart b/lib/src/components/charts/brn_progress_chart/brn_progress_chart_painter.dart index 396e6981..de391f0d 100644 --- a/lib/src/components/charts/brn_progress_chart/brn_progress_chart_painter.dart +++ b/lib/src/components/charts/brn_progress_chart/brn_progress_chart_painter.dart @@ -1,5 +1,3 @@ - - import 'package:flutter/material.dart'; class BrnProgressChartPainter extends CustomPainter { diff --git a/lib/src/components/dialog/brn_dialog.dart b/lib/src/components/dialog/brn_dialog.dart index 3355f46d..c5ecafbe 100644 --- a/lib/src/components/dialog/brn_dialog.dart +++ b/lib/src/components/dialog/brn_dialog.dart @@ -91,7 +91,6 @@ enum _ButtonType { right, } - ///高度灵活的通用的弹窗组件 /// ///布局规则: diff --git a/lib/src/components/empty/brn_empty_status.dart b/lib/src/components/empty/brn_empty_status.dart index 2522c917..3a3af529 100644 --- a/lib/src/components/empty/brn_empty_status.dart +++ b/lib/src/components/empty/brn_empty_status.dart @@ -24,9 +24,9 @@ enum AbnormalState { class BrnAbnormalStateUtils { /// 通过状态获取对应空页面widget /// status: 页面状态类型为[EmptyState] - static Widget getEmptyWidgetByState(BuildContext context, - AbnormalState status, - {Image? img,BrnEmptyStatusIndexedActionClickCallback? action}) { + static Widget getEmptyWidgetByState( + BuildContext context, AbnormalState status, + {Image? img, BrnEmptyStatusIndexedActionClickCallback? action}) { if (AbnormalState.getDataFailed == status) { return BrnAbnormalStateWidget( img: img ?? BrunoTools.getAssetImage(BrnAsset.emptyState), @@ -136,7 +136,7 @@ class BrnAbnormalStateWidget extends StatelessWidget { Widget build(BuildContext context) { return GestureDetector( onTap: () { - if (this.enablePageTap && action!=null) { + if (this.enablePageTap && action != null) { action!(0); } }, diff --git a/lib/src/components/form/base/brn_form_item_type.dart b/lib/src/components/form/base/brn_form_item_type.dart index 08e1cf60..9b38866b 100644 --- a/lib/src/components/form/base/brn_form_item_type.dart +++ b/lib/src/components/form/base/brn_form_item_type.dart @@ -1,5 +1,3 @@ - - class BrnPrefixIconType { static const String normal = "type_normal"; static const String add = "type_add"; @@ -17,8 +15,7 @@ class BrnInputItemType { static const String textArrayInputType = "text_array_input_type"; static const String textSelectInputType = "text_select_input_type"; static const String textBlockInputType = "text_block_input_type"; - static const String textInputTitleSelectType = - "text_input_title_select_type"; + static const String textInputTitleSelectType = "text_input_title_select_type"; static const String textRangeInputType = "text_range_input_type"; static const String textStepInputType = "text_step_input_type"; static const String radioInputType = "radio_input_type"; @@ -34,8 +31,7 @@ class BrnInputItemType { static const String normalGroupType = "normal_group_type"; static const String textInputRatioType = "text_input_ratio_type"; - static const String textQuickSelectInputType = - "text_quick_select_input_type"; + static const String textQuickSelectInputType = "text_quick_select_input_type"; /// bottom类型 static const String bottomBtnType = "bottom_btn_type"; diff --git a/lib/src/components/form/base/input_item_interface.dart b/lib/src/components/form/base/input_item_interface.dart index 757f960a..b33340be 100644 --- a/lib/src/components/form/base/input_item_interface.dart +++ b/lib/src/components/form/base/input_item_interface.dart @@ -1,8 +1,6 @@ /// 用于model兼容回调 /// 主要用于各种点击事件 - - typedef OnBrnFormSelectAll = void Function(int index, bool isSelect); /// 主要用于各种输入值变化 diff --git a/lib/src/components/form/items/general/brn_multi_choice_input_item.dart b/lib/src/components/form/items/general/brn_multi_choice_input_item.dart index 1c632b54..071a88a2 100644 --- a/lib/src/components/form/items/general/brn_multi_choice_input_item.dart +++ b/lib/src/components/form/items/general/brn_multi_choice_input_item.dart @@ -192,9 +192,7 @@ class BrnMultiChoiceInputFormItemState radioIndex: index, disable: getRadioEnableState(index), isSelected: - (pos < _selectStatus.length) - ? _selectStatus[pos] - : false, + (pos < _selectStatus.length) ? _selectStatus[pos] : false, onValueChangedAtIndex: (position, value) { _selectStatus[position] = value; List oldValue = []..addAll(widget.value); diff --git a/lib/src/components/form/items/general/brn_multi_choice_portrait_input_item.dart b/lib/src/components/form/items/general/brn_multi_choice_portrait_input_item.dart index 8ed2e616..bcbc3d26 100644 --- a/lib/src/components/form/items/general/brn_multi_choice_portrait_input_item.dart +++ b/lib/src/components/form/items/general/brn_multi_choice_portrait_input_item.dart @@ -188,9 +188,8 @@ class BrnMultiChoicePortraitInputFormItemState mainAxisSize: MainAxisSize.max, radioIndex: index, disable: getRadioEnableState(index), - isSelected: (index < _selectStatus.length) - ? _selectStatus[index] - : false, + isSelected: + (index < _selectStatus.length) ? _selectStatus[index] : false, onValueChangedAtIndex: (position, value) { _selectStatus[position] = value; List oldValue = []..addAll(widget.value); diff --git a/lib/src/components/form/items/general/brn_radio_input_item.dart b/lib/src/components/form/items/general/brn_radio_input_item.dart index b13c7eba..2a6acf0c 100644 --- a/lib/src/components/form/items/general/brn_radio_input_item.dart +++ b/lib/src/components/form/items/general/brn_radio_input_item.dart @@ -1,5 +1,3 @@ - - import 'dart:math'; import 'package:bruno/src/components/form/base/brn_form_item_type.dart'; @@ -291,7 +289,7 @@ class BrnRadioInputFormItemState extends State { } Widget _buildTitleTextWidget() { - return Text(widget.title , + return Text(widget.title, overflow: widget.titleMaxLines == null ? TextOverflow.clip : TextOverflow.ellipsis, @@ -366,7 +364,8 @@ class BrnRadioInputFormItemState extends State { )), disable: getRadioEnableState(index), radioIndex: index, - isSelected: index == widget.options!.indexOf(widget.value ?? ''), + isSelected: + index == widget.options!.indexOf(widget.value ?? ''), onValueChangedAtIndex: (int position, bool selected) { if (getRadioEnableState(position)) { return; diff --git a/lib/src/components/form/items/general/brn_radio_portrait_input_item.dart b/lib/src/components/form/items/general/brn_radio_portrait_input_item.dart index 3a446f72..0262ef0c 100644 --- a/lib/src/components/form/items/general/brn_radio_portrait_input_item.dart +++ b/lib/src/components/form/items/general/brn_radio_portrait_input_item.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/bruno.dart'; import 'package:bruno/src/components/form/base/brn_form_item_type.dart'; import 'package:bruno/src/components/form/base/input_item_interface.dart'; diff --git a/lib/src/components/form/items/general/brn_range_input_item.dart b/lib/src/components/form/items/general/brn_range_input_item.dart index 00d4d1ea..10c48293 100644 --- a/lib/src/components/form/items/general/brn_range_input_item.dart +++ b/lib/src/components/form/items/general/brn_range_input_item.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/src/components/form/base/brn_form_item_type.dart'; import 'package:bruno/src/components/form/utils/brn_form_util.dart'; import 'package:bruno/src/theme/brn_theme_configurator.dart'; @@ -309,7 +307,7 @@ class BrnRangeInputFormItemState extends State { void dispose() { super.dispose(); // 如果controller由外部创建不需要销毁, 若由内部创建则需要销毁 - _minController.dispose(); - _maxController.dispose(); + _minController.dispose(); + _maxController.dispose(); } } diff --git a/lib/src/components/form/items/general/brn_ratio_input_item.dart b/lib/src/components/form/items/general/brn_ratio_input_item.dart index 2a5c1293..513a09a7 100644 --- a/lib/src/components/form/items/general/brn_ratio_input_item.dart +++ b/lib/src/components/form/items/general/brn_ratio_input_item.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/src/components/form/base/brn_form_item_type.dart'; import 'package:bruno/src/components/form/utils/brn_form_util.dart'; import 'package:bruno/src/theme/brn_theme_configurator.dart'; @@ -213,6 +211,6 @@ class BrnRatioInputFormItemState extends State { void dispose() { super.dispose(); // 如果controller由外部创建不需要销毁, 若由内部创建则需要销毁 - _controller.dispose(); + _controller.dispose(); } } diff --git a/lib/src/components/form/items/general/brn_star_input_item.dart b/lib/src/components/form/items/general/brn_star_input_item.dart index b19cf5ab..a164fd76 100644 --- a/lib/src/components/form/items/general/brn_star_input_item.dart +++ b/lib/src/components/form/items/general/brn_star_input_item.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/src/components/form/base/brn_form_item_type.dart'; import 'package:bruno/src/components/form/base/input_item_interface.dart'; import 'package:bruno/src/components/form/utils/brn_form_util.dart'; diff --git a/lib/src/components/form/items/general/brn_text_block_input_item.dart b/lib/src/components/form/items/general/brn_text_block_input_item.dart index 7fbc70b2..7aeded7e 100644 --- a/lib/src/components/form/items/general/brn_text_block_input_item.dart +++ b/lib/src/components/form/items/general/brn_text_block_input_item.dart @@ -189,7 +189,7 @@ class BrnTextBlockInputFormItemState extends State { widget.themeData!, widget.isEdit), inputFormatters: widget.inputFormatters, decoration: InputDecoration( - hintText: widget.hint , + hintText: widget.hint, hintStyle: BrnFormUtil.getHintTextStyle(widget.themeData!), contentPadding: EdgeInsets.all(0), border: InputBorder.none, diff --git a/lib/src/components/form/items/general/brn_text_input_item.dart b/lib/src/components/form/items/general/brn_text_input_item.dart index 02058a33..d5580025 100644 --- a/lib/src/components/form/items/general/brn_text_input_item.dart +++ b/lib/src/components/form/items/general/brn_text_input_item.dart @@ -182,7 +182,8 @@ class BrnTextInputFormItemState extends State { widget.themeData!, widget.isEdit), decoration: InputDecoration( border: InputBorder.none, - hintStyle: BrnFormUtil.getHintTextStyle(widget.themeData!), + hintStyle: + BrnFormUtil.getHintTextStyle(widget.themeData!), hintText: widget.hint, counterText: "", contentPadding: EdgeInsets.all(0), diff --git a/lib/src/components/form/items/general/brn_text_select_item.dart b/lib/src/components/form/items/general/brn_text_select_item.dart index 1678b5c8..60123cc2 100644 --- a/lib/src/components/form/items/general/brn_text_select_item.dart +++ b/lib/src/components/form/items/general/brn_text_select_item.dart @@ -1,5 +1,3 @@ - - import 'dart:math'; import 'package:bruno/src/components/form/base/brn_form_item_type.dart'; @@ -378,7 +376,7 @@ class BrnTextSelectFormItemState extends State { return Text( widget.value!, overflow: TextOverflow.ellipsis, - maxLines: widget.valueMaxLines , + maxLines: widget.valueMaxLines, textAlign: TextAlign.end, strutStyle: _contentStructStyle, style: BrnFormUtil.getIsEditTextStyle(widget.themeData!, widget.isEdit, diff --git a/lib/src/components/form/items/group/brn_expandable_group.dart b/lib/src/components/form/items/group/brn_expandable_group.dart index 0c56bd95..25331038 100644 --- a/lib/src/components/form/items/group/brn_expandable_group.dart +++ b/lib/src/components/form/items/group/brn_expandable_group.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - - import 'package:bruno/src/components/form/utils/brn_form_util.dart'; import 'package:bruno/src/constants/brn_asset_constants.dart'; import 'package:bruno/src/theme/brn_theme_configurator.dart'; @@ -41,7 +39,7 @@ class BrnExpandableGroup extends StatefulWidget { this.children = const [], this.initiallyExpanded = false, this.themeData, - }) : super(key: key) { + }) : super(key: key) { this.themeData ??= BrnFormItemConfig(); this.themeData = BrnThemeConfigurator.instance .getConfig(configId: this.themeData!.configId) @@ -126,8 +124,7 @@ class _BrnExpansionElementState extends State } if (_isExpanded) { - arrowIcon = - BrunoTools.getAssetSizeImage(BrnAsset.iconDownArrow, 12, 12); + arrowIcon = BrunoTools.getAssetSizeImage(BrnAsset.iconDownArrow, 12, 12); } else { arrowIcon = BrunoTools.getAssetSizeImage(BrnAsset.iconUpArrow, 12, 12); } diff --git a/lib/src/components/form/items/group/brn_portrait_radio_group.dart b/lib/src/components/form/items/group/brn_portrait_radio_group.dart index 88ecbf44..8effb924 100644 --- a/lib/src/components/form/items/group/brn_portrait_radio_group.dart +++ b/lib/src/components/form/items/group/brn_portrait_radio_group.dart @@ -74,7 +74,7 @@ class BrnPortraitRadioGroup extends StatefulWidget { this.onChanged, this.isCollapseContent = false, this.themeData, - }) :super(key: key){ + }) : super(key: key) { this.themeData ??= BrnFormItemConfig(); this.themeData = BrnThemeConfigurator.instance .getConfig(configId: this.themeData!.configId) diff --git a/lib/src/components/form/items/group/element_expand_widget.dart b/lib/src/components/form/items/group/element_expand_widget.dart index 72164ba6..2fb1dd1e 100644 --- a/lib/src/components/form/items/group/element_expand_widget.dart +++ b/lib/src/components/form/items/group/element_expand_widget.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - - import 'package:bruno/src/components/form/utils/brn_form_util.dart'; import 'package:bruno/src/theme/brn_theme_configurator.dart'; import 'package:bruno/src/theme/configs/brn_form_config.dart'; @@ -43,7 +41,7 @@ class ExpansionElementWidget extends StatefulWidget { this.deleteText, this.callback, this.themeData, - }) : super(key: key) { + }) : super(key: key) { this.themeData ??= BrnFormItemConfig(); this.themeData = BrnThemeConfigurator.instance .getConfig(configId: this.themeData!.configId) diff --git a/lib/src/components/form/items/misc/brn_add_label_item.dart b/lib/src/components/form/items/misc/brn_add_label_item.dart index 731c179d..1aa01d18 100644 --- a/lib/src/components/form/items/misc/brn_add_label_item.dart +++ b/lib/src/components/form/items/misc/brn_add_label_item.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/src/components/form/base/brn_form_item_type.dart'; import 'package:bruno/src/components/form/utils/brn_form_util.dart'; import 'package:bruno/src/theme/brn_theme_configurator.dart'; diff --git a/lib/src/components/form/items/misc/brn_title_item.dart b/lib/src/components/form/items/misc/brn_title_item.dart index a3d77a21..199c1065 100644 --- a/lib/src/components/form/items/misc/brn_title_item.dart +++ b/lib/src/components/form/items/misc/brn_title_item.dart @@ -105,8 +105,8 @@ class BrnTitleFormItemState extends State { Container( child: Text( widget.title, - style: - BrnFormUtil.getHeadTitleTextStyle(widget.themeData!), + style: BrnFormUtil.getHeadTitleTextStyle( + widget.themeData!), )), // 问号提示 diff --git a/lib/src/components/form/items/title/brn_base_title_item.dart b/lib/src/components/form/items/title/brn_base_title_item.dart index 90a1ba0a..18971ff9 100644 --- a/lib/src/components/form/items/title/brn_base_title_item.dart +++ b/lib/src/components/form/items/title/brn_base_title_item.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/src/components/form/utils/brn_form_util.dart'; import 'package:bruno/src/theme/brn_theme_configurator.dart'; import 'package:bruno/src/theme/configs/brn_form_config.dart'; @@ -53,11 +51,11 @@ class BrnBaseTitle extends StatefulWidget { BrnBaseTitle({ Key? key, - this.title= "", + this.title = "", this.subTitle, - this.isRequire= false, - this.isEdit= true, - this.error= "", + this.isRequire = false, + this.isEdit = true, + this.error = "", this.tipLabel, this.titleWidget, this.subTitleWidget, diff --git a/lib/src/components/form/items/title/brn_select_all_title_item.dart b/lib/src/components/form/items/title/brn_select_all_title_item.dart index 9f1c804b..010f2471 100644 --- a/lib/src/components/form/items/title/brn_select_all_title_item.dart +++ b/lib/src/components/form/items/title/brn_select_all_title_item.dart @@ -78,7 +78,7 @@ class BrnSelectAllTitle extends StatefulWidget { this.selectState = true, this.themeData, this.customActionWidget, - }):super(key: key) { + }) : super(key: key) { this.themeData ??= BrnFormItemConfig(); this.themeData = BrnThemeConfigurator.instance .getConfig(configId: this.themeData!.configId) diff --git a/lib/src/components/form/utils/brn_form_util.dart b/lib/src/components/form/utils/brn_form_util.dart index 5ae9d8c7..8098acb6 100644 --- a/lib/src/components/form/utils/brn_form_util.dart +++ b/lib/src/components/form/utils/brn_form_util.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/src/components/form/base/brn_form_item_type.dart'; import 'package:bruno/src/components/form/base/input_item_interface.dart'; import 'package:bruno/src/constants/brn_asset_constants.dart'; @@ -137,7 +135,6 @@ class BrnFormUtil { } static Widget getRequireIcon(bool isRequire) { - return Container( padding: isRequire ? EdgeInsets.only(right: 2) : EdgeInsets.only(right: 0), @@ -285,8 +282,11 @@ class BrnFormUtil { } /// 处理 单选选中状态变化 - static void notifyRadioStatusChanged(OnBrnFormRadioValueChanged? onTextChanged, - BuildContext context, Object? oldVal, Object? newVal) { + static void notifyRadioStatusChanged( + OnBrnFormRadioValueChanged? onTextChanged, + BuildContext context, + Object? oldVal, + Object? newVal) { if (onTextChanged != null) { onTextChanged(oldVal as String?, newVal as String?); } diff --git a/lib/src/components/gallery/config/brn_controller.dart b/lib/src/components/gallery/config/brn_controller.dart index fffb4c9f..2e51bd14 100644 --- a/lib/src/components/gallery/config/brn_controller.dart +++ b/lib/src/components/gallery/config/brn_controller.dart @@ -1,5 +1,3 @@ - - import 'package:flutter/material.dart'; /// 控制页面刷新,并跳转到指定的 index diff --git a/lib/src/components/line/brn_dashed_line.dart b/lib/src/components/line/brn_dashed_line.dart index c7a2abe4..7636a8a4 100644 --- a/lib/src/components/line/brn_dashed_line.dart +++ b/lib/src/components/line/brn_dashed_line.dart @@ -34,7 +34,6 @@ const BrnDashedLinePosition _normalPosition = BrnDashedLinePosition.leading; /// 虚线分割线 class BrnDashedLine extends StatelessWidget { - /// 虚线方向,默认值[_normalAxis] final Axis axis; @@ -76,10 +75,10 @@ class BrnDashedLine extends StatelessWidget { return CustomPaint( painter: BrnDashedPainter( axis: this.axis, - dashedLength: this.dashedLength , + dashedLength: this.dashedLength, dashedThickness: this.dashedThickness, - dashedSpacing: this.dashedSpacing , - color: this.color , + dashedSpacing: this.dashedSpacing, + color: this.color, dashedOffset: this.dashedOffset, position: this.position), child: this.contentWidget, @@ -124,7 +123,11 @@ class BrnDashedPainter extends CustomPainter { var paint = Paint() // 创建一个画笔并配置其属性 ..strokeWidth = this.dashedThickness // 画笔的宽度 ..isAntiAlias = true // 是否抗锯齿 - ..color = this.color?? BrnThemeConfigurator.instance.getConfig().commonConfig.dividerColorBase; // 画笔颜色 + ..color = this.color ?? + BrnThemeConfigurator.instance + .getConfig() + .commonConfig + .dividerColorBase; // 画笔颜色 var maxWidth = size.width; // size获取到宽度 var maxHeight = size.height; // size获取到宽度 diff --git a/lib/src/components/line/brn_line.dart b/lib/src/components/line/brn_line.dart index ef7a14d4..850f6fae 100644 --- a/lib/src/components/line/brn_line.dart +++ b/lib/src/components/line/brn_line.dart @@ -45,8 +45,11 @@ class BrnLine extends StatelessWidget { child: Divider( thickness: this.height, height: this.height, - color: - this.color ?? BrnThemeConfigurator.instance.getConfig().commonConfig.dividerColorBase, + color: this.color ?? + BrnThemeConfigurator.instance + .getConfig() + .commonConfig + .dividerColorBase, ), ); } diff --git a/lib/src/components/navbar/brn_search_bar.dart b/lib/src/components/navbar/brn_search_bar.dart index 802ab87e..aa1ffa98 100644 --- a/lib/src/components/navbar/brn_search_bar.dart +++ b/lib/src/components/navbar/brn_search_bar.dart @@ -167,7 +167,7 @@ class _SearchInputWidget extends StatefulWidget { this.textEditingController, this.searchBarInputChangeCallback, this.searchBarInputSubmitCallback, - this.hint= '请输入搜索内容', + this.hint = '请输入搜索内容', this.hintStyle, this.inputTextStyle, this.showDivider = true, diff --git a/lib/src/components/picker/base/brn_picker.dart b/lib/src/components/picker/base/brn_picker.dart index e5cb5fa8..2ac02551 100644 --- a/lib/src/components/picker/base/brn_picker.dart +++ b/lib/src/components/picker/base/brn_picker.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - - import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/rendering.dart'; @@ -74,7 +72,7 @@ class BrnPicker extends StatefulWidget { required this.onSelectedItemChanged, required List children, bool looping = false, - }) :assert(diameterRatio > 0.0, + }) : assert(diameterRatio > 0.0, RenderListWheelViewport.diameterRatioZeroMessage), assert(magnification > 0), assert(itemExtent > 0), @@ -235,8 +233,7 @@ class _CupertinoPickerState extends State { // have to just do a color blend. And a due to the way we are layering // the magnifier and the gradient on the background, using a transparent // background color makes the picker look odd. - if (widget.backgroundColor.alpha < 255) - return Container(); + if (widget.backgroundColor.alpha < 255) return Container(); final Color widgetBackgroundColor = widget.backgroundColor; return Positioned.fill( diff --git a/lib/src/components/picker/base/brn_picker_title.dart b/lib/src/components/picker/base/brn_picker_title.dart index 7079cbbf..157c5fac 100755 --- a/lib/src/components/picker/base/brn_picker_title.dart +++ b/lib/src/components/picker/base/brn_picker_title.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/src/components/picker/time_picker/brn_date_picker_constants.dart'; import 'package:bruno/src/components/picker/base/brn_picker_title_config.dart'; import 'package:bruno/src/theme/brn_theme.dart'; diff --git a/lib/src/components/picker/base/brn_picker_title_config.dart b/lib/src/components/picker/base/brn_picker_title_config.dart index 84d0cafc..004d07d2 100755 --- a/lib/src/components/picker/base/brn_picker_title_config.dart +++ b/lib/src/components/picker/base/brn_picker_title_config.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/src/components/picker/base/brn_picker_constants.dart'; import 'package:flutter/material.dart'; diff --git a/lib/src/components/picker/brn_bottom_picker.dart b/lib/src/components/picker/brn_bottom_picker.dart index 91a531c9..ce6cacea 100644 --- a/lib/src/components/picker/brn_bottom_picker.dart +++ b/lib/src/components/picker/brn_bottom_picker.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/src/components/picker/base/brn_picker_title.dart'; import 'package:bruno/src/components/picker/base/brn_picker_title_config.dart'; import 'package:bruno/src/components/picker/brn_picker_cliprrect.dart'; diff --git a/lib/src/components/picker/brn_bottom_write_picker.dart b/lib/src/components/picker/brn_bottom_write_picker.dart index c5a5cbaf..0575875e 100644 --- a/lib/src/components/picker/brn_bottom_write_picker.dart +++ b/lib/src/components/picker/brn_bottom_write_picker.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/src/components/picker/base/brn_picker_title_config.dart'; import 'package:bruno/src/components/picker/brn_bottom_picker.dart'; import 'package:bruno/src/theme/brn_theme_configurator.dart'; diff --git a/lib/src/components/picker/brn_mulit_select_tags_picker.dart b/lib/src/components/picker/brn_mulit_select_tags_picker.dart index d222640d..83476849 100644 --- a/lib/src/components/picker/brn_mulit_select_tags_picker.dart +++ b/lib/src/components/picker/brn_mulit_select_tags_picker.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/src/components/picker/base/brn_picker_title_config.dart'; import 'package:bruno/src/components/picker/brn_tags_common_picker.dart'; import 'package:bruno/src/components/picker/brn_tags_picker_config.dart'; @@ -130,7 +128,7 @@ class BrnMultiSelectTagsPicker extends CommonTagsPicker { Widget _buildGridViewWidget( BuildContext context, VoidCallback? onUpdate, double maxWidth) { int brnCrossAxisCount = - (this.crossAxisCount == null || this.crossAxisCount == 0) + (this.crossAxisCount == null || this.crossAxisCount == 0) ? 4 : this.crossAxisCount!; double width = diff --git a/lib/src/components/picker/brn_multi_picker.dart b/lib/src/components/picker/brn_multi_picker.dart index e6ad7cc4..73ecdcfb 100644 --- a/lib/src/components/picker/brn_multi_picker.dart +++ b/lib/src/components/picker/brn_multi_picker.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/src/components/picker/base/brn_picker.dart'; import 'package:bruno/src/components/picker/base/brn_picker_title.dart'; import 'package:bruno/src/components/picker/base/brn_picker_title_config.dart'; @@ -293,7 +291,8 @@ class _BrnMultiDataPickerState extends State { child: Text( widget.delegate.titleForRowInComponent(component, i), style: _selectedIndexList[component] == i - ? widget.themeData!.itemTextSelectedStyle.generateTextStyle() + ? widget.themeData!.itemTextSelectedStyle + .generateTextStyle() : widget.themeData!.itemTextStyle.generateTextStyle(), ), )); diff --git a/lib/src/components/picker/brn_select_tags_with_input_picker.dart b/lib/src/components/picker/brn_select_tags_with_input_picker.dart index bb39f13f..7f4c0f1c 100644 --- a/lib/src/components/picker/brn_select_tags_with_input_picker.dart +++ b/lib/src/components/picker/brn_select_tags_with_input_picker.dart @@ -222,13 +222,12 @@ class _BrnSelectTagsWithInputPickerWidgetState for (BrnTagInputItemBean item in widget.tagPickerBean!.tagItemSource) { tagItems.add(item); //选中的按钮 - if (item.isSelect == true ) { + if (item.isSelect == true) { tagSelectedItems.add(item); } } } - this._sourceTags = tagItems; // 重新排序,name 越长,越靠后 this._sourceTags.sort((left, right) { diff --git a/lib/src/components/picker/brn_tags_common_picker.dart b/lib/src/components/picker/brn_tags_common_picker.dart index d6cb4a5e..592c5fa0 100644 --- a/lib/src/components/picker/brn_tags_common_picker.dart +++ b/lib/src/components/picker/brn_tags_common_picker.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/src/components/picker/base/brn_picker_title.dart'; import 'package:bruno/src/components/picker/base/brn_picker_title_config.dart'; import 'package:bruno/src/components/picker/brn_picker_cliprrect.dart'; diff --git a/lib/src/components/picker/brn_tags_picker_config.dart b/lib/src/components/picker/brn_tags_picker_config.dart index 1303df3c..e379fc8f 100644 --- a/lib/src/components/picker/brn_tags_picker_config.dart +++ b/lib/src/components/picker/brn_tags_picker_config.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/src/theme/brn_theme_configurator.dart'; import 'package:flutter/material.dart'; diff --git a/lib/src/components/picker/multi_range_picker/bean/brn_multi_column_picker_entity.dart b/lib/src/components/picker/multi_range_picker/bean/brn_multi_column_picker_entity.dart index f62db1ec..de1983f6 100644 --- a/lib/src/components/picker/multi_range_picker/bean/brn_multi_column_picker_entity.dart +++ b/lib/src/components/picker/multi_range_picker/bean/brn_multi_column_picker_entity.dart @@ -16,7 +16,8 @@ enum PickerWindowType { class BrnPickerEntity { String? uniqueId; //唯一的id - String? type; //类型 目前支持的类型有不限(unlimit)、单选(radio)、复选(checkbox), 最终被解析成 PickerFilterType 类型 + String? + type; //类型 目前支持的类型有不限(unlimit)、单选(radio)、复选(checkbox), 最终被解析成 PickerFilterType 类型 String? key; //回传给服务器 String? value; //回传给服务器 String name; //显示的文案 @@ -63,9 +64,8 @@ class BrnPickerEntity { } entity.extMap = map['ext'] ?? {}; // entity.children = map['children'] ?? []; - entity.children = [] - ..addAll((map['children'] as List? ?? []) - .map((o) => BrnPickerEntity.fromMap(o))); + entity.children = []..addAll((map['children'] as List? ?? []) + .map((o) => BrnPickerEntity.fromMap(o))); return entity; } @@ -158,7 +158,7 @@ class BrnPickerEntity { List selectedListWithoutUnlimit() { List selected = selectedList(); - return selected.where((_) => !_.isUnLimit()).toList() ; + return selected.where((_) => !_.isUnLimit()).toList(); } List selectedList() { @@ -167,16 +167,16 @@ class BrnPickerEntity { results.addAll(firstColumn); if (firstColumn.length > 0) { for (BrnPickerEntity firstEntity in firstColumn) { - List secondColumn = - this.currentSelectListForEntity(firstEntity); - results.addAll(secondColumn); - if (secondColumn.length > 0) { - for (BrnPickerEntity secondEntity in secondColumn) { - List thirdColumn = - this.currentSelectListForEntity(secondEntity); - results.addAll(thirdColumn); - } + List secondColumn = + this.currentSelectListForEntity(firstEntity); + results.addAll(secondColumn); + if (secondColumn.length > 0) { + for (BrnPickerEntity secondEntity in secondColumn) { + List thirdColumn = + this.currentSelectListForEntity(secondEntity); + results.addAll(thirdColumn); } + } } } return results; @@ -222,8 +222,7 @@ class BrnPickerEntity { } bool isInLastLevel() { - if (parent == null || - parent!.children.length == 0) return true; + if (parent == null || parent!.children.length == 0) return true; for (BrnPickerEntity entity in parent!.children) { if (entity.children.length > 0) { diff --git a/lib/src/components/picker/multi_range_picker/brn_multi_column_converter.dart b/lib/src/components/picker/multi_range_picker/brn_multi_column_converter.dart index c4c60f41..c97cf9df 100644 --- a/lib/src/components/picker/multi_range_picker/brn_multi_column_converter.dart +++ b/lib/src/components/picker/multi_range_picker/brn_multi_column_converter.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/src/components/picker/multi_range_picker/bean/brn_multi_column_picker_entity.dart'; import 'package:bruno/src/components/picker/multi_range_picker/brn_multi_column_picker_util.dart'; import 'package:bruno/src/utils/brn_tools.dart'; @@ -56,7 +54,7 @@ class BrnMultiRangeSelConverter { Map> params, Map> selectedParams) { selectedParams.forEach((String? key, List value) { - if ( params.containsKey(key)) { + if (params.containsKey(key)) { params[key]?.addAll(value); } else { params.addAll(selectedParams); diff --git a/lib/src/components/picker/multi_range_picker/brn_multi_column_list.dart b/lib/src/components/picker/multi_range_picker/brn_multi_column_list.dart index 1d6b7a55..3deeb02c 100644 --- a/lib/src/components/picker/multi_range_picker/brn_multi_column_list.dart +++ b/lib/src/components/picker/multi_range_picker/brn_multi_column_list.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/src/components/picker/multi_range_picker/bean/brn_multi_column_picker_entity.dart'; import 'package:bruno/src/components/picker/multi_range_picker/brn_multi_column_picker.dart'; import 'package:bruno/src/components/picker/multi_range_picker/brn_multi_column_picker_util.dart'; @@ -105,7 +103,7 @@ class _BrnMultiColumnListWidgetState extends State { return; } _processFilterData(entity); - if(widget.singleListItemPick!=null){ + if (widget.singleListItemPick != null) { widget.singleListItemPick!( widget.currentListIndex ?? 0, index, entity); } @@ -141,7 +139,7 @@ class _BrnMultiColumnListWidgetState extends State { int totalLevel = BrnMultiColumnPickerUtil.getTotalColumnCount(selectedEntity); - if (selectedEntity.isUnLimit() && selectedEntity.parent !=null) { + if (selectedEntity.isUnLimit() && selectedEntity.parent != null) { selectedEntity.parent!.clearChildSelection(); } @@ -161,7 +159,7 @@ class _BrnMultiColumnListWidgetState extends State { /// 只有当它子节点被选中时才会认为第一列的节点相应被选中。 if (widget.items != null && widget.items!.length > 0 && - widget.items![0].parent != null ) { + widget.items![0].parent != null) { widget.items![0].parent?.isSelected = widget.items![0].parent!.children .where((BrnPickerEntity f) => f.isSelected) .length > @@ -209,7 +207,8 @@ class _BrnMultiColumnListWidgetState extends State { } } - void _configSecondList(BrnPickerEntity selectedEntity, int? currentListIndex) { + void _configSecondList( + BrnPickerEntity selectedEntity, int? currentListIndex) { if (currentListIndex == 1) { if (PickerFilterType.checkbox != selectedEntity.filterType) { selectedEntity.parent!.clearChildSelection(); diff --git a/lib/src/components/picker/multi_range_picker/brn_multi_column_picker.dart b/lib/src/components/picker/multi_range_picker/brn_multi_column_picker.dart index e070c441..b726aa17 100644 --- a/lib/src/components/picker/multi_range_picker/brn_multi_column_picker.dart +++ b/lib/src/components/picker/multi_range_picker/brn_multi_column_picker.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/src/components/picker/base/brn_picker_title.dart'; import 'package:bruno/src/components/picker/base/brn_picker_title_config.dart'; import 'package:bruno/src/components/picker/brn_picker_cliprrect.dart'; diff --git a/lib/src/components/picker/multi_range_picker/brn_multi_column_picker_util.dart b/lib/src/components/picker/multi_range_picker/brn_multi_column_picker_util.dart index 03a0d5d7..e9210c49 100644 --- a/lib/src/components/picker/multi_range_picker/brn_multi_column_picker_util.dart +++ b/lib/src/components/picker/multi_range_picker/brn_multi_column_picker_util.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/src/components/picker/multi_range_picker/bean/brn_multi_column_picker_entity.dart'; /// BrnMultiColumnPicker相关工具类 @@ -12,8 +10,7 @@ class BrnMultiColumnPickerUtil { rootEntity = rootEntity?.parent!; } - if (rootEntity != null && - rootEntity.children.length > 0) { + if (rootEntity != null && rootEntity.children.length > 0) { count = count > 1 ? count : 1; for (BrnPickerEntity firstLevelEntity in rootEntity.children) { if (firstLevelEntity.children.length > 0) { diff --git a/lib/src/components/picker/multi_range_picker/btn_multi_column_picker_item.dart b/lib/src/components/picker/multi_range_picker/btn_multi_column_picker_item.dart index 55dbb9be..ad27b5b9 100644 --- a/lib/src/components/picker/multi_range_picker/btn_multi_column_picker_item.dart +++ b/lib/src/components/picker/multi_range_picker/btn_multi_column_picker_item.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/src/components/picker/multi_range_picker/bean/brn_multi_column_picker_entity.dart'; import 'package:bruno/src/components/picker/multi_range_picker/brn_multi_column_picker_util.dart'; import 'package:bruno/src/constants/brn_asset_constants.dart'; @@ -36,8 +34,7 @@ class BrnMultiRangePickerCommonItem extends StatelessWidget { @override Widget build(BuildContext context) { var checkbox; - if (!item.isUnLimit() && - (item.children.length == 0)) { + if (!item.isUnLimit() && (item.children.length == 0)) { if (item.isInLastLevel() && _hasCheckBoxBrother(item)) { checkbox = Container( padding: EdgeInsets.only(left: 6), @@ -123,7 +120,7 @@ class BrnMultiRangePickerCommonItem extends StatelessWidget { String _getSelectedItemCount(BrnPickerEntity item) { String itemCount = ""; if ((BrnMultiColumnPickerUtil.getTotalColumnCount(item) < 3 || - !isFirstLevel)) { + !isFirstLevel)) { int count = item.children.where((f) => f.isSelected && !f.isUnLimit()).length; if (count > 1) { diff --git a/lib/src/components/picker/multi_select_bottom_picker/brn_multi_select_data.dart b/lib/src/components/picker/multi_select_bottom_picker/brn_multi_select_data.dart index a48143db..9d9eebab 100644 --- a/lib/src/components/picker/multi_select_bottom_picker/brn_multi_select_data.dart +++ b/lib/src/components/picker/multi_select_bottom_picker/brn_multi_select_data.dart @@ -1,5 +1,3 @@ - - class BrnMultiSelectBottomPickerItem { String code; //选项编号 diff --git a/lib/src/components/picker/multi_select_bottom_picker/brn_multi_select_list_picker.dart b/lib/src/components/picker/multi_select_bottom_picker/brn_multi_select_list_picker.dart index c1427243..d3c4587e 100644 --- a/lib/src/components/picker/multi_select_bottom_picker/brn_multi_select_list_picker.dart +++ b/lib/src/components/picker/multi_select_bottom_picker/brn_multi_select_list_picker.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/src/components/line/brn_line.dart'; import 'package:bruno/src/components/picker/base/brn_picker_constants.dart'; import 'package:bruno/src/components/picker/base/brn_picker_title.dart'; @@ -99,8 +97,7 @@ class MultiSelectDialogWidgetState extends State { child: BrnPickerTitle( pickerTitleConfig: widget.pickerTitleConfig, onConfirm: () { - List selectedItems = - []; + List selectedItems = []; if (widget.onSubmit != null) { for (int i = 0; i < widget.items.length; i++) { if (widget.items[i].isChecked) { @@ -135,56 +132,54 @@ class MultiSelectDialogWidgetState extends State { } Widget _buildItem(BuildContext context, int index) { - - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - setState(() { - widget.items[index].isChecked = !widget.items[index].isChecked; - }); - if (widget.onItemClick != null) { - widget.onItemClick!(context, index); - } - }, - child: Column( - children: [ - Padding( - padding: EdgeInsets.fromLTRB(20, 0, 20, 0), - child: Row( - children: [ - Expanded( - child: Text(widget.items[index].content, - style: TextStyle( - fontSize: 16, - fontWeight: widget.items[index].isChecked - ? FontWeight.w600 - : FontWeight.normal, - color: widget.items[index].isChecked - ? BrnThemeConfigurator.instance - .getConfig() - .commonConfig - .brandPrimary - : BrnThemeConfigurator.instance - .getConfig() - .commonConfig - .colorTextBase))), - Container( - alignment: Alignment.center, - height: 50, - child: widget.items[index].isChecked - ? BrunoTools.getAssetImageWithBandColor( - BrnAsset.iconMultiSelected) - : BrunoTools.getAssetImage(BrnAsset.iconUnSelect)), - ], - ), + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + widget.items[index].isChecked = !widget.items[index].isChecked; + }); + if (widget.onItemClick != null) { + widget.onItemClick!(context, index); + } + }, + child: Column( + children: [ + Padding( + padding: EdgeInsets.fromLTRB(20, 0, 20, 0), + child: Row( + children: [ + Expanded( + child: Text(widget.items[index].content, + style: TextStyle( + fontSize: 16, + fontWeight: widget.items[index].isChecked + ? FontWeight.w600 + : FontWeight.normal, + color: widget.items[index].isChecked + ? BrnThemeConfigurator.instance + .getConfig() + .commonConfig + .brandPrimary + : BrnThemeConfigurator.instance + .getConfig() + .commonConfig + .colorTextBase))), + Container( + alignment: Alignment.center, + height: 50, + child: widget.items[index].isChecked + ? BrunoTools.getAssetImageWithBandColor( + BrnAsset.iconMultiSelected) + : BrunoTools.getAssetImage(BrnAsset.iconUnSelect)), + ], ), - index != widget.items.length - 1 - ? Padding( - padding: EdgeInsets.fromLTRB(20, 0, 20, 0), - child: BrnLine()) - : Container() - ], - )); - + ), + index != widget.items.length - 1 + ? Padding( + padding: EdgeInsets.fromLTRB(20, 0, 20, 0), + child: BrnLine()) + : Container() + ], + )); } } diff --git a/lib/src/components/picker/time_picker/brn_date_picker_constants.dart b/lib/src/components/picker/time_picker/brn_date_picker_constants.dart index 8c8dffe6..f8c04c82 100755 --- a/lib/src/components/picker/time_picker/brn_date_picker_constants.dart +++ b/lib/src/components/picker/time_picker/brn_date_picker_constants.dart @@ -1,7 +1,5 @@ /// Selected value of DatePicker. - - typedef DateValueCallback(DateTime dateTime, List selectedIndex); typedef DateRangeValueCallback(DateTime startDateTime, DateTime endDateTime, diff --git a/lib/src/components/picker/time_picker/date_picker/brn_date_picker.dart b/lib/src/components/picker/time_picker/date_picker/brn_date_picker.dart index a9680532..db374f50 100755 --- a/lib/src/components/picker/time_picker/date_picker/brn_date_picker.dart +++ b/lib/src/components/picker/time_picker/date_picker/brn_date_picker.dart @@ -267,7 +267,8 @@ class _DatePickerComponent extends StatelessWidget { builder: (BuildContext context, Widget? child) { return ClipRect( child: CustomSingleChildLayout( - delegate: _BottomPickerLayout(route.animation!.value, _pickerHeight), + delegate: + _BottomPickerLayout(route.animation!.value, _pickerHeight), child: BrnPickerClipRRect( borderRadius: BorderRadius.only( topLeft: Radius.circular(route.themeData!.cornerRadius), diff --git a/lib/src/components/picker/time_picker/date_picker/brn_date_widget.dart b/lib/src/components/picker/time_picker/date_picker/brn_date_widget.dart index 1d0b2a9f..d25336eb 100755 --- a/lib/src/components/picker/time_picker/date_picker/brn_date_widget.dart +++ b/lib/src/components/picker/time_picker/date_picker/brn_date_widget.dart @@ -1,5 +1,3 @@ - - import 'dart:math'; import 'package:bruno/src/components/picker/base/brn_picker.dart'; @@ -27,7 +25,7 @@ class BrnDateWidget extends StatefulWidget { this.initialDateTime, this.dateFormat = datetimePickerDateFormat, this.locale = datetimePickerLocaleDefault, - this.pickerTitleConfig= BrnPickerTitleConfig.Default, + this.pickerTitleConfig = BrnPickerTitleConfig.Default, this.onCancel, this.onChange, this.onConfirm, @@ -63,7 +61,9 @@ class _BrnDateWidgetState extends State { late DateTime _minDateTime, _maxDateTime; late int _currYear, _currMonth, _currDay; late List _yearRange, _monthRange, _dayRange; - late FixedExtentScrollController? _yearScrollCtrl, _monthScrollCtrl, _dayScrollCtrl; + late FixedExtentScrollController? _yearScrollCtrl, + _monthScrollCtrl, + _dayScrollCtrl; late Map _scrollCtrlMap; late Map?> _valueRangeMap; diff --git a/lib/src/components/picker/time_picker/date_picker/brn_datetime_widget.dart b/lib/src/components/picker/time_picker/date_picker/brn_datetime_widget.dart index b0f33a65..88c42a12 100755 --- a/lib/src/components/picker/time_picker/date_picker/brn_datetime_widget.dart +++ b/lib/src/components/picker/time_picker/date_picker/brn_datetime_widget.dart @@ -1,5 +1,3 @@ - - import 'dart:math'; import 'package:bruno/src/components/picker/base/brn_picker.dart'; @@ -80,8 +78,8 @@ class _BrnDateTimeWidgetState extends State { int? _minuteDivider; - _BrnDateTimeWidgetState(DateTime? minTime, DateTime? maxTime, DateTime? initTime, - int? minuteDivider) { + _BrnDateTimeWidgetState(DateTime? minTime, DateTime? maxTime, + DateTime? initTime, int? minuteDivider) { // check minTime value if (minTime == null) { minTime = DateTime.parse(datePickerMinDatetime); @@ -216,29 +214,19 @@ class _BrnDateTimeWidgetState extends State { /// 如果传入的时间格式不包含 月、天、小时、分钟、秒。则相对应的时间置为 1,1,0,0,0; DateTime dateTime = DateTime( _currYear, - (formatArr.where((format) => format.contains('M')).toList()) - .length > - 0 + (formatArr.where((format) => format.contains('M')).toList()).length > 0 ? _currMonth : 1, - (formatArr.where((format) => format.contains('d')).toList()) - .length > - 0 + (formatArr.where((format) => format.contains('d')).toList()).length > 0 ? _currDay : 1, - (formatArr.where((format) => format.contains('H')).toList()) - .length > - 0 + (formatArr.where((format) => format.contains('H')).toList()).length > 0 ? _currHour : 0, - (formatArr.where((format) => format.contains('m')).toList()) - .length > - 0 + (formatArr.where((format) => format.contains('m')).toList()).length > 0 ? _currMinute : 0, - (formatArr.where((format) => format.contains('s')).toList()) - .length > - 0 + (formatArr.where((format) => format.contains('s')).toList()).length > 0 ? _currSecond : 0, ); @@ -575,8 +563,8 @@ class _BrnDateTimeWidgetState extends State { if (minuteRangeChanged) { // CupertinoPicker refresh data not working (https://github.com/flutter/flutter/issues/22999) - _minuteScrollCtrl - .jumpToItem((minuteRange.last - minuteRange.first) ~/ _minuteDivider!); + _minuteScrollCtrl.jumpToItem( + (minuteRange.last - minuteRange.first) ~/ _minuteDivider!); if (_currMinute < minuteRange.last) { _minuteScrollCtrl .jumpToItem((_currMinute - minuteRange.first) ~/ _minuteDivider!); diff --git a/lib/src/components/picker/time_picker/date_picker/brn_time_widget.dart b/lib/src/components/picker/time_picker/date_picker/brn_time_widget.dart index 1e9e0491..8dcbabbf 100755 --- a/lib/src/components/picker/time_picker/date_picker/brn_time_widget.dart +++ b/lib/src/components/picker/time_picker/date_picker/brn_time_widget.dart @@ -1,5 +1,3 @@ - - import 'dart:math'; import 'package:bruno/src/components/picker/base/brn_picker.dart'; diff --git a/lib/src/components/picker/time_picker/date_range_picker/brn_date_range_picker.dart b/lib/src/components/picker/time_picker/date_range_picker/brn_date_range_picker.dart index 023aa757..c228832f 100755 --- a/lib/src/components/picker/time_picker/date_range_picker/brn_date_range_picker.dart +++ b/lib/src/components/picker/time_picker/date_range_picker/brn_date_range_picker.dart @@ -236,7 +236,8 @@ class _DatePickerComponent extends StatelessWidget { builder: (BuildContext context, Widget? child) { return ClipRect( child: CustomSingleChildLayout( - delegate: _BottomPickerLayout(route.animation!.value, _pickerHeight), + delegate: + _BottomPickerLayout(route.animation!.value, _pickerHeight), child: BrnPickerClipRRect( borderRadius: BorderRadius.only( topLeft: Radius.circular(route.themeData!.cornerRadius), diff --git a/lib/src/components/picker/time_picker/date_range_picker/brn_date_range_widget.dart b/lib/src/components/picker/time_picker/date_range_picker/brn_date_range_widget.dart index e5f311b1..0ddeb116 100755 --- a/lib/src/components/picker/time_picker/date_range_picker/brn_date_range_widget.dart +++ b/lib/src/components/picker/time_picker/date_range_picker/brn_date_range_widget.dart @@ -1,5 +1,3 @@ - - import 'dart:math'; import 'package:bruno/src/components/picker/base/brn_picker.dart'; diff --git a/lib/src/components/picker/time_picker/date_range_picker/brn_time_range_side_widget.dart b/lib/src/components/picker/time_picker/date_range_picker/brn_time_range_side_widget.dart index 79112dde..f01f2e0a 100755 --- a/lib/src/components/picker/time_picker/date_range_picker/brn_time_range_side_widget.dart +++ b/lib/src/components/picker/time_picker/date_range_picker/brn_time_range_side_widget.dart @@ -1,5 +1,3 @@ - - import 'dart:math'; import 'package:bruno/src/components/picker/base/brn_picker.dart'; @@ -129,7 +127,6 @@ class _TimePickerWidgetState extends State { min(max(_minuteRange.first, _currStartMinute), _minuteRange.last); _currStartMinute -= _currStartMinute % _minuteDivider; - _onInitSelectedChange(); // create scroll controller _startHourScrollCtrl = FixedExtentScrollController( diff --git a/lib/src/components/popup/brn_measure_size.dart b/lib/src/components/popup/brn_measure_size.dart index d2e08eaf..4715b456 100644 --- a/lib/src/components/popup/brn_measure_size.dart +++ b/lib/src/components/popup/brn_measure_size.dart @@ -37,6 +37,7 @@ class MeasureSize extends SingleChildRenderObjectWidget { required this.onChange, required Widget child, }) : super(key: key, child: child); + @override RenderObject createRenderObject(BuildContext context) { return MeasureSizeRenderObject(onChange); diff --git a/lib/src/components/radio/brn_checkbox.dart b/lib/src/components/radio/brn_checkbox.dart index 80437ca6..ae1f216c 100644 --- a/lib/src/components/radio/brn_checkbox.dart +++ b/lib/src/components/radio/brn_checkbox.dart @@ -43,18 +43,18 @@ class BrnCheckbox extends StatefulWidget { /// 默认值HitTestBehavior.translucent控制widget.onRadioItemClick触发的点击范围 final HitTestBehavior behavior; - const BrnCheckbox({ - Key? key, - required this.radioIndex, - required this.onValueChangedAtIndex, - this.disable = false, - this.isSelected = false, - this.iconPadding, - this.child, - this.childOnRight = true, - this.mainAxisAlignment = MainAxisAlignment.start, - this.mainAxisSize = MainAxisSize.min, - this.behavior = HitTestBehavior.translucent}); + const BrnCheckbox( + {Key? key, + required this.radioIndex, + required this.onValueChangedAtIndex, + this.disable = false, + this.isSelected = false, + this.iconPadding, + this.child, + this.childOnRight = true, + this.mainAxisAlignment = MainAxisAlignment.start, + this.mainAxisSize = MainAxisSize.min, + this.behavior = HitTestBehavior.translucent}); @override State createState() { diff --git a/lib/src/components/radio/brn_radio_button.dart b/lib/src/components/radio/brn_radio_button.dart index ef3bd3ec..44c93e20 100644 --- a/lib/src/components/radio/brn_radio_button.dart +++ b/lib/src/components/radio/brn_radio_button.dart @@ -43,19 +43,18 @@ class BrnRadioButton extends StatelessWidget { /// 默认值HitTestBehavior.translucent控制widget.onRadioItemClick触发的点击范围 final HitTestBehavior behavior; - const BrnRadioButton({ - Key? key, - required this.radioIndex, - required this.onValueChangedAtIndex, - this.disable = false, - this.isSelected = false, - this.iconPadding, - this.child, - this.childOnRight = true, - this.mainAxisAlignment = MainAxisAlignment.start, - this.mainAxisSize = MainAxisSize.min, - this.behavior = HitTestBehavior.translucent - }); + const BrnRadioButton( + {Key? key, + required this.radioIndex, + required this.onValueChangedAtIndex, + this.disable = false, + this.isSelected = false, + this.iconPadding, + this.child, + this.childOnRight = true, + this.mainAxisAlignment = MainAxisAlignment.start, + this.mainAxisSize = MainAxisSize.min, + this.behavior = HitTestBehavior.translucent}); @override Widget build(BuildContext context) { diff --git a/lib/src/components/scroll_anchor/brn_scroll_anchor_tab.dart b/lib/src/components/scroll_anchor/brn_scroll_anchor_tab.dart index 29b3fea2..cdc20e7e 100644 --- a/lib/src/components/scroll_anchor/brn_scroll_anchor_tab.dart +++ b/lib/src/components/scroll_anchor/brn_scroll_anchor_tab.dart @@ -1,5 +1,3 @@ - - import 'dart:async'; import 'dart:ui'; @@ -175,8 +173,9 @@ class _BrnScrollAnchorTabWidgetState extends State } void fillOffset() { - Offset globalToLocal = (_key.currentContext!.findRenderObject() as RenderBox) - .localToGlobal(Offset.zero); + Offset globalToLocal = + (_key.currentContext!.findRenderObject() as RenderBox) + .localToGlobal(Offset.zero); listDy = globalToLocal.dy; for (int i = 0, n = widget.itemCount; i < n; i++) { @@ -193,9 +192,9 @@ class _BrnScrollAnchorTabWidgetState extends State } void fillTab() { - for (int i = 0, n = widget.itemCount; i < n; i++) { - _tabList.add(widget.tabIndexedBuilder(context, i)); - } + for (int i = 0, n = widget.itemCount; i < n; i++) { + _tabList.add(widget.tabIndexedBuilder(context, i)); + } } void updateOffset() { diff --git a/lib/src/components/selection/bean/brn_selection_common_entity.dart b/lib/src/components/selection/bean/brn_selection_common_entity.dart index c4c04c94..1bc70af5 100644 --- a/lib/src/components/selection/bean/brn_selection_common_entity.dart +++ b/lib/src/components/selection/bean/brn_selection_common_entity.dart @@ -158,20 +158,20 @@ class BrnSelectionEntity { entity.value = map['value'] ?? ""; if (map['maxSelectedCount'] != null && int.tryParse(map['maxSelectedCount']) != null) { - entity.maxSelectedCount = int.tryParse(map['maxSelectedCount']) ?? BrnSelectionConstant.maxSelectCount; + entity.maxSelectedCount = int.tryParse(map['maxSelectedCount']) ?? + BrnSelectionConstant.maxSelectCount; } else { entity.maxSelectedCount = BrnSelectionConstant.maxSelectCount; } entity.extMap = map['ext'] ?? {}; - if(map['children'] != null && map['children'] is List) { - entity.children = []..addAll((map['children'] as List) - .map((o) => BrnSelectionEntity.fromMap(o))); + if (map['children'] != null && map['children'] is List) { + entity.children = []..addAll( + (map['children'] as List).map((o) => BrnSelectionEntity.fromMap(o))); } entity.filterType = entity.parserFilterTypeWithType(map['type'] ?? ""); return entity; } - BrnSelectionEntity.fromJson(Map? map) : this.title = '', this.maxSelectedCount = BrnSelectionConstant.maxSelectCount, @@ -186,13 +186,14 @@ class BrnSelectionEntity { type = map['type'] ?? ''; defaultValue = map['defaultValue'] ?? ''; value = map['value'] ?? ''; - if (map['maxSelectedCount'] != null && int.tryParse(map['maxSelectedCount']) != null) { - maxSelectedCount = - int.tryParse(map['maxSelectedCount']) ?? BrnSelectionConstant.maxSelectCount; + if (map['maxSelectedCount'] != null && + int.tryParse(map['maxSelectedCount']) != null) { + maxSelectedCount = int.tryParse(map['maxSelectedCount']) ?? + BrnSelectionConstant.maxSelectCount; } extMap = map['ext'] ?? {}; - children = [] - ..addAll((map['children'] ?? []).map((o) => BrnSelectionEntity.fromJson(o))); + children = []..addAll( + (map['children'] ?? []).map((o) => BrnSelectionEntity.fromJson(o))); filterType = parserFilterTypeWithType(map['type'] ?? ''); isSelected = false; } @@ -251,7 +252,8 @@ class BrnSelectionEntity { if (hasCheckBoxBrother()) { isSelected = children.where((_) => _.isSelected).length > 0; } else { - isSelected = isSelected || children.where((_) => _.isSelected).length > 0; + isSelected = + isSelected || children.where((_) => _.isSelected).length > 0; } } } @@ -342,19 +344,20 @@ class BrnSelectionEntity { List selectedListWithoutUnlimit() { List selected = selectedList(); return selected - .where((_) => !_.isUnLimit()) - .where((_) => - (_.filterType != BrnSelectionFilterType.range) || - (_.filterType == BrnSelectionFilterType.range && !BrunoTools.isEmpty(_.customMap))) - .where((_) => - (_.filterType != BrnSelectionFilterType.dateRange) || - (_.filterType == BrnSelectionFilterType.dateRange && - !BrunoTools.isEmpty(_.customMap))) - .where((_) => - (_.filterType != BrnSelectionFilterType.dateRangeCalendar) || - (_.filterType == BrnSelectionFilterType.dateRangeCalendar && - !BrunoTools.isEmpty(_.customMap))) - .toList(); + .where((_) => !_.isUnLimit()) + .where((_) => + (_.filterType != BrnSelectionFilterType.range) || + (_.filterType == BrnSelectionFilterType.range && + !BrunoTools.isEmpty(_.customMap))) + .where((_) => + (_.filterType != BrnSelectionFilterType.dateRange) || + (_.filterType == BrnSelectionFilterType.dateRange && + !BrunoTools.isEmpty(_.customMap))) + .where((_) => + (_.filterType != BrnSelectionFilterType.dateRangeCalendar) || + (_.filterType == BrnSelectionFilterType.dateRangeCalendar && + !BrunoTools.isEmpty(_.customMap))) + .toList(); } List selectedList() { @@ -362,7 +365,8 @@ class BrnSelectionEntity { return this.selectedLastColumnList(); } else { List results = []; - List firstColumn = BrnSelectionUtil.currentSelectListForEntity(this); + List firstColumn = + BrnSelectionUtil.currentSelectListForEntity(this); results.addAll(firstColumn); if (firstColumn.length > 0) { for (BrnSelectionEntity firstEntity in firstColumn) { @@ -384,7 +388,8 @@ class BrnSelectionEntity { List allSelectedList() { List results = []; - List firstColumn = BrnSelectionUtil.currentSelectListForEntity(this); + List firstColumn = + BrnSelectionUtil.currentSelectListForEntity(this); results.addAll(firstColumn); if (firstColumn.length > 0) { for (BrnSelectionEntity firstEntity in firstColumn) { @@ -413,7 +418,8 @@ class BrnSelectionEntity { BrnSelectionEntity getRootEntity(BrnSelectionEntity rootEntity) { if (rootEntity.parent == null || - rootEntity.parent!.maxSelectedCount == BrnSelectionConstant.maxSelectCount) { + rootEntity.parent!.maxSelectedCount == + BrnSelectionConstant.maxSelectCount) { return rootEntity; } else { return getRootEntity(rootEntity.parent!); @@ -460,8 +466,9 @@ class BrnSelectionEntity { /// 检查自己的兄弟结点是否存在 checkbox 类型。 bool hasCheckBoxBrother() { - int? count = - parent?.children.where((f) => f.filterType == BrnSelectionFilterType.checkbox).length; + int? count = parent?.children + .where((f) => f.filterType == BrnSelectionFilterType.checkbox) + .length; return count == null ? false : count > 0; } @@ -561,7 +568,9 @@ class BrnSelectionEntity { int? inputMax = int.tryParse(customMap!['max'] ?? ""); if (inputMax != null && inputMin != null) { - if (inputMin >= limitMin && inputMax <= limitMax && inputMax >= inputMin) { + if (inputMin >= limitMin && + inputMax <= limitMax && + inputMax >= inputMin) { return true; } else { return false; diff --git a/lib/src/components/selection/brn_flat_selection.dart b/lib/src/components/selection/brn_flat_selection.dart index e581dde6..8fd19c9a 100644 --- a/lib/src/components/selection/brn_flat_selection.dart +++ b/lib/src/components/selection/brn_flat_selection.dart @@ -61,10 +61,12 @@ class BrnFlatSelection extends StatefulWidget { _BrnFlatSelectionState createState() => _BrnFlatSelectionState(); } -class _BrnFlatSelectionState extends State with SingleTickerProviderStateMixin { +class _BrnFlatSelectionState extends State + with SingleTickerProviderStateMixin { List _originalSelectedItemsList = []; - StreamController clearController = StreamController.broadcast(); + StreamController clearController = + StreamController.broadcast(); bool isValid = true; double _lineWidth = 0.0; @@ -74,7 +76,8 @@ class _BrnFlatSelectionState extends State with SingleTickerPr super.initState(); if (widget.isNeedConfigChild) { - widget.entityDataList.forEach((f) => f.configRelationshipAndDefaultValue()); + widget.entityDataList + .forEach((f) => f.configRelationshipAndDefaultValue()); } widget.controller?.addListener(_handleFlatControllerTick); @@ -193,8 +196,8 @@ class _BrnFlatSelectionState extends State with SingleTickerPr } }); if (widget.confirmCallback != null) { - widget - .confirmCallback!(DefaultSelectionConverter().convertSelectedData(widget.entityDataList)); + widget.confirmCallback!(DefaultSelectionConverter() + .convertSelectedData(widget.entityDataList)); } } diff --git a/lib/src/components/selection/brn_more_selection.dart b/lib/src/components/selection/brn_more_selection.dart index 95d90c72..b07f6ee0 100644 --- a/lib/src/components/selection/brn_more_selection.dart +++ b/lib/src/components/selection/brn_more_selection.dart @@ -58,7 +58,8 @@ class _BrnMoreSelectionPageState extends State duration: const Duration(milliseconds: 300), vsync: this, ); - _animation = Tween(end: Offset.zero, begin: Offset(1.0, 0.0)).animate(_controller); + _animation = + Tween(end: Offset.zero, begin: Offset(1.0, 0.0)).animate(_controller); _controller.forward(); _originalSelectedItemsList.addAll(widget.entityData.allSelectedList()); diff --git a/lib/src/components/selection/brn_selection_list_entity.dart b/lib/src/components/selection/brn_selection_list_entity.dart index ce2c36dd..2b272680 100644 --- a/lib/src/components/selection/brn_selection_list_entity.dart +++ b/lib/src/components/selection/brn_selection_list_entity.dart @@ -8,7 +8,9 @@ class BrnSelectionEntityListBean { static BrnSelectionEntityListBean? fromJson(Map? map) { if (map == null || map['list'] == null) return null; BrnSelectionEntityListBean bean = BrnSelectionEntityListBean(null); - bean.list = (map['list'] as List).map((o) => BrnSelectionEntity.fromMap(o)).toList(); + bean.list = (map['list'] as List) + .map((o) => BrnSelectionEntity.fromMap(o)) + .toList(); return bean; } } diff --git a/lib/src/components/selection/brn_selection_view.dart b/lib/src/components/selection/brn_selection_view.dart index 659070c4..1843df76 100644 --- a/lib/src/components/selection/brn_selection_view.dart +++ b/lib/src/components/selection/brn_selection_view.dart @@ -18,8 +18,11 @@ typedef BrnConfigTagCountPerRow(int index, BrnSelectionEntity entity); typedef BrnSetCustomSelectionMenuTitle = void Function( {String menuTitle, bool isMenuTitleHighLight}); -typedef BrnOnSelectionChanged = void Function(int menuIndex, Map selectedParams, - Map customParams, BrnSetCustomSelectionMenuTitle setCustomMenuTitle); +typedef BrnOnSelectionChanged = void Function( + int menuIndex, + Map selectedParams, + Map customParams, + BrnSetCustomSelectionMenuTitle setCustomMenuTitle); /// menu 点击拦截回调 /// [index] menu 的索引位置 @@ -33,21 +36,26 @@ typedef BrnOnSelectionPreShow = BrnSelectionWindowType Function( /// 点击【更多】筛选项时的回调, /// [index] 为点击的位置, /// [openMorePage] 为让用户触发的回调用于展开更多筛选页面 -typedef BrnOnMoreSelectionMenuClick = void Function(int index, BrnOpenMorePage openMorePage); +typedef BrnOnMoreSelectionMenuClick = void Function( + int index, BrnOpenMorePage openMorePage); /// 打开更多筛选页面, /// [updateData] 是否要更新更多筛选的数据, /// [moreSelections] 最新的更多筛选数据,是否更新取决于 [updateData] -typedef BrnOpenMorePage = void Function({bool updateData, List moreSelections}); +typedef BrnOpenMorePage = void Function( + {bool updateData, List moreSelections}); /// 自定义类型的 Menu 被点击时 让外部设置选中的 value 进来统一更新 UI,并将 function 传给外部设置筛选值。 -typedef BrnSetCustomSelectionParams = void Function(Map customParams); +typedef BrnSetCustomSelectionParams = void Function( + Map customParams); /// 自定义类型的 menu 被点击的回调, /// [index] 点击位置, /// [customMenuItem] 自定义筛选 menu 原始数据, /// [customSelectionParams] 开放给外部回调给函数,用于更新自定义筛选参数,触发[BrnOnSelectionChanged]。 -typedef BrnOnCustomSelectionMenuClick = Function(int index, BrnSelectionEntity customMenuItem, +typedef BrnOnCustomSelectionMenuClick = Function( + int index, + BrnSelectionEntity customMenuItem, BrnSetCustomSelectionParams customSelectionParams); /// 当更多筛选页面中,类型为 CustomLayer 被回调时,该函数用于回传参数进 BrnSelectionView 中, @@ -62,12 +70,15 @@ typedef BrnSetCustomFloatingLayerSelectionParams = void Function( typedef BrnOnCustomFloatingLayerClick = Function( int index, BrnSelectionEntity customFloatingLayerEntity, - BrnSetCustomFloatingLayerSelectionParams setCustomFloatingLayerSelectionParams); + BrnSetCustomFloatingLayerSelectionParams + setCustomFloatingLayerSelectionParams); -typedef OnDefaultParamsPrepared = void Function(Map selectedParams); +typedef OnDefaultParamsPrepared = void Function( + Map selectedParams); /// 默认筛选参数转换器,对传入的筛选数据做处理,返回 Map 参数对象。 -const BrnSelectionConverterDelegate _defaultConverter = const DefaultSelectionConverter(); +const BrnSelectionConverterDelegate _defaultConverter = + const DefaultSelectionConverter(); // ignore: must_be_immutable class BrnSelectionView extends StatefulWidget { @@ -130,15 +141,18 @@ class BrnSelectionView extends StatefulWidget { class BrnSelectionViewState extends State { Map _customParams = Map(); BrnSelectionViewController? _selectionViewController; + @override void initState() { super.initState(); - _selectionViewController = widget.selectionViewController ?? BrnSelectionViewController(); - widget.originalSelectionData.forEach((f) => f.configRelationshipAndDefaultValue()); + _selectionViewController = + widget.selectionViewController ?? BrnSelectionViewController(); + widget.originalSelectionData + .forEach((f) => f.configRelationshipAndDefaultValue()); if (widget.onDefaultParamsPrepared != null) { - widget.onDefaultParamsPrepared!( - widget.selectionConverterDelegate.convertSelectedData(widget.originalSelectionData)); + widget.onDefaultParamsPrepared!(widget.selectionConverterDelegate + .convertSelectedData(widget.originalSelectionData)); } } @@ -154,13 +168,15 @@ class BrnSelectionViewState extends State { constantTop: widget.constantTop, configRowCount: widget.configRowCount, onMenuItemClick: (int menuIndex) { - if (widget.onMenuClickInterceptor != null && widget.onMenuClickInterceptor!(menuIndex)) { + if (widget.onMenuClickInterceptor != null && + widget.onMenuClickInterceptor!(menuIndex)) { return true; } if (widget.onSelectionPreShow != null) { widget.originalSelectionData[menuIndex].filterShowType = - widget.onSelectionPreShow!(menuIndex, widget.originalSelectionData[menuIndex]); + widget.onSelectionPreShow!( + menuIndex, widget.originalSelectionData[menuIndex]); } /// 自定义 Menu 的时候, @@ -170,7 +186,8 @@ class BrnSelectionViewState extends State { if (widget.originalSelectionData[menuIndex].filterType == BrnSelectionFilterType.customHandle && widget.onCustomSelectionMenuClick != null) { - widget.onCustomSelectionMenuClick!(menuIndex, widget.originalSelectionData[menuIndex], + widget.onCustomSelectionMenuClick!( + menuIndex, widget.originalSelectionData[menuIndex], (Map customParams) { _customParams.clear(); _customParams.addAll(customParams); @@ -180,23 +197,30 @@ class BrnSelectionViewState extends State { } /// 自定义 Menu 的时候,让外部设置选中的 value 进来统一更新 UI。 然后触发 _onSelectionChanged 统一回调给外部 - if (widget.originalSelectionData[menuIndex].filterType == BrnSelectionFilterType.more && + if (widget.originalSelectionData[menuIndex].filterType == + BrnSelectionFilterType.more && widget.onMoreSelectionMenuClick != null) { widget.onMoreSelectionMenuClick!(menuIndex, ( - {bool updateData = false, List? moreSelections}) { + {bool updateData = false, + List? moreSelections}) { if (updateData) { - List moreSelectionEntities = moreSelections ?? []; - widget.originalSelectionData[menuIndex].children = moreSelectionEntities; - widget.originalSelectionData[menuIndex].configRelationshipAndDefaultValue(); + List moreSelectionEntities = + moreSelections ?? []; + widget.originalSelectionData[menuIndex].children = + moreSelectionEntities; + widget.originalSelectionData[menuIndex] + .configRelationshipAndDefaultValue(); } setState(() {}); _openMore(widget.originalSelectionData[menuIndex], - onCustomFloatingLayerClick: widget.onCustomFloatingLayerClick); + onCustomFloatingLayerClick: + widget.onCustomFloatingLayerClick); }); } return false; }, - onConfirm: (BrnSelectionEntity results, int firstIndex, int secondIndex, int thirdIndex) { + onConfirm: (BrnSelectionEntity results, int firstIndex, int secondIndex, + int thirdIndex) { _onSelectionChanged(widget.originalSelectionData.indexOf(results)); }, ); @@ -207,11 +231,14 @@ class BrnSelectionViewState extends State { void _onSelectionChanged(int menuIndex) { widget.onSelectionChanged( menuIndex, - widget.selectionConverterDelegate.convertSelectedData(widget.originalSelectionData), - _customParams, ({String? menuTitle, bool isMenuTitleHighLight = false}) { + widget.selectionConverterDelegate + .convertSelectedData(widget.originalSelectionData), + _customParams, ( + {String? menuTitle, bool isMenuTitleHighLight = false}) { /// 说明没有 menu 被选中,不需要更新。 if (menuIndex >= 0) { - widget.originalSelectionData[menuIndex].isCustomTitleHighLight = isMenuTitleHighLight; + widget.originalSelectionData[menuIndex].isCustomTitleHighLight = + isMenuTitleHighLight; widget.originalSelectionData[menuIndex].customTitle = menuTitle; } @@ -237,7 +264,8 @@ class BrnSelectionViewState extends State { onCustomFloatingLayerClick: onCustomFloatingLayerClick, confirmCallback: (_) { EventBus.instance.fire(RefreshMenuTitleEvent()); - _onSelectionChanged(widget.originalSelectionData.indexOf(entity)); + _onSelectionChanged( + widget.originalSelectionData.indexOf(entity)); }, ); })); diff --git a/lib/src/components/selection/brn_simple_selection.dart b/lib/src/components/selection/brn_simple_selection.dart index bf21351c..be9b1e05 100644 --- a/lib/src/components/selection/brn_simple_selection.dart +++ b/lib/src/components/selection/brn_simple_selection.dart @@ -4,7 +4,8 @@ import 'package:bruno/src/components/selection/brn_selection_view.dart'; import 'package:bruno/src/constants/brn_constants.dart'; import 'package:flutter/material.dart'; -typedef BrnSimpleSelectionOnSelectionChanged = void Function(List selectedParams); +typedef BrnSimpleSelectionOnSelectionChanged = void Function( + List selectedParams); const String _defaultMenuKey = "defaultMenuKey"; @@ -103,10 +104,12 @@ class BrnSimpleSelectionState extends State { Widget build(BuildContext context) { return BrnSelectionView( originalSelectionData: selectionEntityList, - onSelectionChanged: (menuIndex, selectedParams, customParams, setCustomTitleFunction) { + onSelectionChanged: + (menuIndex, selectedParams, customParams, setCustomTitleFunction) { List results = []; String valueStr = selectedParams[widget.menuKey] ?? ''; List values = valueStr.split(','); + ///遍历获取选中的items for (String value in values) { for (ItemEntity item in widget.items) { diff --git a/lib/src/components/selection/controller/brn_selection_view_date_picker_controller.dart b/lib/src/components/selection/controller/brn_selection_view_date_picker_controller.dart index 81376f9d..7a121008 100644 --- a/lib/src/components/selection/controller/brn_selection_view_date_picker_controller.dart +++ b/lib/src/components/selection/controller/brn_selection_view_date_picker_controller.dart @@ -8,7 +8,7 @@ class BrnSelectionDatePickerController extends ChangeNotifier { BrnSelectionDatePickerController({ this.isShow = false, this.entry, -}); + }); void show() { isShow = true; diff --git a/lib/src/components/selection/converter/brn_selection_converter.dart b/lib/src/components/selection/converter/brn_selection_converter.dart index f9b3ce12..6957b473 100644 --- a/lib/src/components/selection/converter/brn_selection_converter.dart +++ b/lib/src/components/selection/converter/brn_selection_converter.dart @@ -4,14 +4,16 @@ import 'package:bruno/src/utils/brn_tools.dart'; abstract class BrnSelectionConverterDelegate { /// 统一的数据结构 转换为 用户需要的数据结构,并通过 [BrnSelectionOnSelectionChanged] 回传给用户使用。 - Map convertSelectedData(List selectedResults); + Map convertSelectedData( + List selectedResults); } class DefaultSelectionConverter implements BrnSelectionConverterDelegate { const DefaultSelectionConverter(); @override - Map convertSelectedData(List selectedResults) { + Map convertSelectedData( + List selectedResults) { return getSelectionParams(selectedResults); } } @@ -20,29 +22,34 @@ class DefaultMoreSelectionConverter implements BrnSelectionConverterDelegate { const DefaultMoreSelectionConverter(); @override - Map convertSelectedData(List selectedResults) { + Map convertSelectedData( + List selectedResults) { return getSelectionParams(selectedResults); } } -class DefaultSelectionQuickFilterConverter implements BrnSelectionConverterDelegate { +class DefaultSelectionQuickFilterConverter + implements BrnSelectionConverterDelegate { const DefaultSelectionQuickFilterConverter(); @override - Map convertSelectedData(List selectedResults) { + Map convertSelectedData( + List selectedResults) { return getSelectionParams(selectedResults); } } /// 注意,此方法仅在初始化筛选项之前调用。如果再筛选之后使用会影响筛选View 的展示以及筛选结果。 -Map getSelectionParamsWithConfigChild(List? selectedResults) { +Map getSelectionParamsWithConfigChild( + List? selectedResults) { Map params = Map(); if (selectedResults == null) return params; selectedResults.forEach((f) => f.configRelationshipAndDefaultValue()); return getSelectionParams(selectedResults); } -Map getSelectionParams(List? selectedResults) { +Map getSelectionParams( + List? selectedResults) { Map params = Map(); if (selectedResults == null) return params; for (BrnSelectionEntity menuItemEntity in selectedResults) { @@ -68,8 +75,8 @@ Map getSelectionParams(List? selectedResults params.addAll(getCurrentSelectionEntityParams(menuItemEntity)); } else if (levelCount == 2) { params.addAll(getCurrentSelectionEntityParams(menuItemEntity)); - menuItemEntity.children.forEach( - (firstLevelItem) => params.addAll(getCurrentSelectionEntityParams(firstLevelItem))); + menuItemEntity.children.forEach((firstLevelItem) => + params.addAll(getCurrentSelectionEntityParams(firstLevelItem))); } else if (levelCount == 3) { params.addAll(getCurrentSelectionEntityParams(menuItemEntity)); menuItemEntity.children.forEach((firstLevelItem) { @@ -84,7 +91,8 @@ Map getSelectionParams(List? selectedResults return params; } -Map getCurrentSelectionEntityParams(BrnSelectionEntity selectionEntity) { +Map getCurrentSelectionEntityParams( + BrnSelectionEntity selectionEntity) { Map params = Map(); String? parentKey = selectionEntity.key; List selectedEntity = selectionEntity.children @@ -92,7 +100,8 @@ Map getCurrentSelectionEntityParams(BrnSelectionEntity selection .where((BrnSelectionEntity f) => !BrunoTools.isEmpty(f.value)) .map((BrnSelectionEntity f) => f.value) .toList(); - String selectedParams = selectedEntity.isEmpty ? '' : selectedEntity.join(','); + String selectedParams = + selectedEntity.isEmpty ? '' : selectedEntity.join(','); if (!BrunoTools.isEmpty(selectedParams) && !BrunoTools.isEmpty(parentKey)) { params[parentKey!] = selectedParams; } diff --git a/lib/src/components/selection/widget/brn_flat_selection_item.dart b/lib/src/components/selection/widget/brn_flat_selection_item.dart index 3f8ffc80..2154786c 100644 --- a/lib/src/components/selection/widget/brn_flat_selection_item.dart +++ b/lib/src/components/selection/widget/brn_flat_selection_item.dart @@ -50,7 +50,7 @@ class BrnFlatMoreSelection extends StatefulWidget { this.preLineTagSize = 3, this.parentWidth = 0, required this.themeData, - }): super(key: key); + }) : super(key: key); @override _BrnFlatMoreSelectionState createState() => _BrnFlatMoreSelectionState(); @@ -61,7 +61,8 @@ class _BrnFlatMoreSelectionState extends State { Widget build(BuildContext context) { //弹出浮层 if (widget.selectionEntity.filterType == BrnSelectionFilterType.layer || - widget.selectionEntity.filterType == BrnSelectionFilterType.customLayer) { + widget.selectionEntity.filterType == + BrnSelectionFilterType.customLayer) { return FilterLayerTypeWidget( selectionEntity: widget.selectionEntity, onCustomFloatingLayerClick: widget.onCustomFloatingLayerClick, @@ -97,7 +98,8 @@ class _FilterCommonTypeWidget extends StatefulWidget { required this.themeData}); @override - __FilterCommonTypeWidgetState createState() => __FilterCommonTypeWidgetState(); + __FilterCommonTypeWidgetState createState() => + __FilterCommonTypeWidgetState(); } class __FilterCommonTypeWidgetState extends State<_FilterCommonTypeWidget> { @@ -151,11 +153,14 @@ class __FilterCommonTypeWidgetState extends State<_FilterCommonTypeWidget> { @override Widget build(BuildContext context) { try { - _tagWidth = (widget.parentWidth - _spacing * (widget.preLineTagSize - 1) - _padding * 2) / + _tagWidth = (widget.parentWidth - + _spacing * (widget.preLineTagSize - 1) - + _padding * 2) / widget.preLineTagSize; //保留小数点后3位 - _tagWidth = double.parse( - _tagWidth.toStringAsFixed(4).substring(0, _tagWidth.toStringAsFixed(4).length - 1)); + _tagWidth = double.parse(_tagWidth + .toStringAsFixed(4) + .substring(0, _tagWidth.toStringAsFixed(4).length - 1)); _tagWidth = _tagWidth < 75 ? 75 : _tagWidth; } catch (e) { debugPrint('get tag width error'); @@ -173,7 +178,10 @@ class __FilterCommonTypeWidgetState extends State<_FilterCommonTypeWidget> { child: _buildTitleWidget(), ), Visibility( - visible: widget.selectionEntity.currentShowTagByExpanded(isExpanded).length > 0, + visible: widget.selectionEntity + .currentShowTagByExpanded(isExpanded) + .length > + 0, child: Container( padding: EdgeInsets.only(top: 12), child: _buildOptionWidgets(), @@ -297,9 +305,12 @@ class __FilterCommonTypeWidgetState extends State<_FilterCommonTypeWidget> { if (data.value == null || data.value!.isEmpty) { showName = data.title; } else { - int time = int.tryParse(data.value ?? "") ?? DateTime.now().millisecondsSinceEpoch; + int time = int.tryParse(data.value ?? "") ?? + DateTime.now().millisecondsSinceEpoch; showName = DateTimeFormatter.formatDate( - DateTime.fromMillisecondsSinceEpoch(time), 'yyyy/MMMM/dd', DateTimePickerLocale.zh_cn); + DateTime.fromMillisecondsSinceEpoch(time), + 'yyyy/MMMM/dd', + DateTimePickerLocale.zh_cn); } } else { showName = data.title; @@ -331,7 +342,8 @@ class __FilterCommonTypeWidgetState extends State<_FilterCommonTypeWidget> { } void _showDatePicker(BrnSelectionEntity data) { - int time = int.tryParse(data.value ?? "") ?? DateTime.now().millisecondsSinceEpoch; + int time = + int.tryParse(data.value ?? "") ?? DateTime.now().millisecondsSinceEpoch; BrnDatePicker.showDatePicker(context, pickerMode: BrnDateTimePickerMode.date, pickerTitleConfig: BrnPickerTitleConfig.Default, @@ -365,8 +377,7 @@ class __MoreArrowState extends State<_MoreArrow> { @override Widget build(BuildContext context) { - String asset = - isExpanded ? BrnAsset.iconUpArrow : BrnAsset.iconDownArrow; + String asset = isExpanded ? BrnAsset.iconUpArrow : BrnAsset.iconDownArrow; return GestureDetector( behavior: HitTestBehavior.opaque, @@ -383,7 +394,8 @@ class __MoreArrowState extends State<_MoreArrow> { child: Row( mainAxisSize: MainAxisSize.min, children: [ - Text('更多', style: widget.themeData.moreTextStyle.generateTextStyle()), + Text('更多', + style: widget.themeData.moreTextStyle.generateTextStyle()), Container( height: 16, width: 16, @@ -468,7 +480,8 @@ class __MoreRangeWidgetState extends State<_MoreRangeWidget> { : ''; min = int.tryParse(widget.rangeEntity.extMap['min']?.toString() ?? '') ?? 0; - max = int.tryParse(widget.rangeEntity.extMap['max']?.toString() ?? '') ?? 9999; + max = int.tryParse(widget.rangeEntity.extMap['max']?.toString() ?? '') ?? + 9999; ///处理的逻辑: /// 1:将输入框的 文本写入 customMap中 @@ -520,13 +533,15 @@ class __MoreRangeWidgetState extends State<_MoreRangeWidget> { /// 如果是多选 则不处理 minFocusNode.addListener(() { if (minFocusNode.hasFocus) { - widget.streamController?.add(InputEvent(filter: false, rangeEntity: widget.rangeEntity)); + widget.streamController + ?.add(InputEvent(filter: false, rangeEntity: widget.rangeEntity)); } }); maxFocusNode.addListener(() { if (maxFocusNode.hasFocus) { - widget.streamController?.add(InputEvent(filter: false, rangeEntity: widget.rangeEntity)); + widget.streamController + ?.add(InputEvent(filter: false, rangeEntity: widget.rangeEntity)); } }); @@ -550,7 +565,8 @@ class __MoreRangeWidgetState extends State<_MoreRangeWidget> { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.center, children: [ - _buildRangeField('最小值', minController, minFocusNode, widget.width, widget.themeData), + _buildRangeField( + '最小值', minController, minFocusNode, widget.width, widget.themeData), Padding( padding: EdgeInsets.only(left: 2), ), @@ -562,7 +578,8 @@ class __MoreRangeWidgetState extends State<_MoreRangeWidget> { Padding( padding: EdgeInsets.only(right: 2), ), - _buildRangeField('最大值', maxController, maxFocusNode, widget.width, widget.themeData), + _buildRangeField( + '最大值', maxController, maxFocusNode, widget.width, widget.themeData), ], ); } @@ -576,7 +593,8 @@ class __MoreRangeWidgetState extends State<_MoreRangeWidget> { ) { return Container( decoration: BoxDecoration( - color: Color(0xFFF9F9F9), borderRadius: BorderRadius.all(Radius.circular(4.0))), + color: Color(0xFFF9F9F9), + borderRadius: BorderRadius.all(Radius.circular(4.0))), height: 32, width: width, child: Center( @@ -603,7 +621,10 @@ class FilterLayerTypeWidget extends StatefulWidget { final BrnOnCustomFloatingLayerClick? onCustomFloatingLayerClick; final BrnSelectionConfig themeData; - FilterLayerTypeWidget({required this.selectionEntity, this.onCustomFloatingLayerClick, required this.themeData}); + FilterLayerTypeWidget( + {required this.selectionEntity, + this.onCustomFloatingLayerClick, + required this.themeData}); @override _FilterLayerTypeWidgetState createState() => _FilterLayerTypeWidgetState(); @@ -627,7 +648,8 @@ class _FilterLayerTypeWidgetState extends State { padding: const EdgeInsets.only(left: 20, right: 20, top: 6), child: GestureDetector( onTap: () { - if (widget.selectionEntity.filterType == BrnSelectionFilterType.layer) { + if (widget.selectionEntity.filterType == + BrnSelectionFilterType.layer) { Navigator.of(context) .push(PageRouteBuilder( opaque: false, @@ -640,18 +662,21 @@ class _FilterLayerTypeWidgetState extends State { .then((data) { updateContent(); }); - } else if (widget.selectionEntity.filterType == BrnSelectionFilterType.customLayer) { + } else if (widget.selectionEntity.filterType == + BrnSelectionFilterType.customLayer) { if (widget.onCustomFloatingLayerClick != null) { int entityIndex = -1; if (widget.selectionEntity.parent != null && widget.selectionEntity.parent!.children.isNotEmpty) { - entityIndex = - widget.selectionEntity.parent!.children.indexOf(widget.selectionEntity); + entityIndex = widget.selectionEntity.parent!.children + .indexOf(widget.selectionEntity); } - widget.onCustomFloatingLayerClick!(entityIndex, widget.selectionEntity, + widget.onCustomFloatingLayerClick!( + entityIndex, widget.selectionEntity, (List customFloatingLayerParams) { widget.selectionEntity.children.clear(); - widget.selectionEntity.children.addAll(customFloatingLayerParams); + widget.selectionEntity.children + .addAll(customFloatingLayerParams); widget.selectionEntity.configDefaultValue(); setState(() {}); }); @@ -665,7 +690,8 @@ class _FilterLayerTypeWidgetState extends State { child: Text(isEmptyCondition() ? '请选择' : getCondition(), style: isEmptyCondition() ? widget.themeData.hintTextStyle.generateTextStyle() - : widget.themeData.optionTextStyle.generateTextStyle()), + : widget.themeData.optionTextStyle + .generateTextStyle()), ), Container( height: 16, @@ -693,7 +719,8 @@ class _FilterLayerTypeWidgetState extends State { String getCondition() { String tmp = ""; //返回所有选中的 - List selectedList = widget.selectionEntity.selectedList(); + List selectedList = + widget.selectionEntity.selectedList(); //判断步骤: //第一步:取出来所有选中的: 房山 不限 小白楼 西城 不限 diff --git a/lib/src/components/selection/widget/brn_layer_more_selection_page.dart b/lib/src/components/selection/widget/brn_layer_more_selection_page.dart index f345c1cb..24880dd1 100644 --- a/lib/src/components/selection/widget/brn_layer_more_selection_page.dart +++ b/lib/src/components/selection/widget/brn_layer_more_selection_page.dart @@ -21,10 +21,11 @@ class BrnLayerMoreSelectionPage extends StatefulWidget { Key? key, required this.entityData, required this.themeData, - }): super(key: key); + }) : super(key: key); @override - _BrnLayerMoreSelectionPageState createState() => _BrnLayerMoreSelectionPageState(); + _BrnLayerMoreSelectionPageState createState() => + _BrnLayerMoreSelectionPageState(); } class _BrnLayerMoreSelectionPageState extends State @@ -52,7 +53,8 @@ class _BrnLayerMoreSelectionPageState extends State duration: const Duration(milliseconds: 300), vsync: this, ); - _animation = Tween(end: Offset.zero, begin: Offset(1.0, 0.0)).animate(_controller); + _animation = + Tween(end: Offset.zero, begin: Offset(1.0, 0.0)).animate(_controller); _controller.forward(); _originalSelectedItemsList = widget.entityData.selectedList(); @@ -125,7 +127,10 @@ class _BrnLayerMoreSelectionPageState extends State leading: IconButton( icon: Icon( Icons.arrow_back, - color: BrnThemeConfigurator.instance.getConfig().commonConfig.colorTextBase, + color: BrnThemeConfigurator.instance + .getConfig() + .commonConfig + .colorTextBase, ), onPressed: () { //将选中的筛选项返回 @@ -140,7 +145,10 @@ class _BrnLayerMoreSelectionPageState extends State title: Text( '选择${widget.entityData.title}', style: TextStyle( - color: BrnThemeConfigurator.instance.getConfig().commonConfig.colorTextBase, + color: BrnThemeConfigurator.instance + .getConfig() + .commonConfig + .colorTextBase, fontSize: 16, fontWeight: FontWeight.w600), ), @@ -224,7 +232,8 @@ class _BrnLayerMoreSelectionPageState extends State }); if (!this._firstList[index].isSelected) { - if (!BrnSelectionUtil.checkMaxSelectionCount(_firstList[index])) { + if (!BrnSelectionUtil.checkMaxSelectionCount( + _firstList[index])) { BrnToast.show('您选择的筛选条件数量已达上限', context); setState(() {}); return; @@ -290,10 +299,12 @@ class _BrnLayerMoreSelectionPageState extends State Widget _buildLeftItem(int index) { //如果房山 被选中了或者房山处于正在选择的状态 则加粗 - TextStyle textStyle = widget.themeData.flayerNormalTextStyle.generateTextStyle(); + TextStyle textStyle = + widget.themeData.flayerNormalTextStyle.generateTextStyle(); if (index == _currentIndex) { textStyle = widget.themeData.flayerSelectedTextStyle.generateTextStyle(); - } else if ((_firstList[index].isSelected) && _firstList[index].selectedList().isNotEmpty) { + } else if ((_firstList[index].isSelected) && + _firstList[index].selectedList().isNotEmpty) { textStyle = widget.themeData.flayerBoldTextStyle.generateTextStyle(); } @@ -313,7 +324,8 @@ class _BrnLayerMoreSelectionPageState extends State bool containsCheckChildren = false; if (_firstList[index].children.isNotEmpty) { - containsCheckChildren = _firstList[index].children[0].hasCheckBoxBrother(); + containsCheckChildren = + _firstList[index].children[0].hasCheckBoxBrother(); } if (containsCheck && containsCheckChildren) { name += '(${list.length})'; @@ -335,9 +347,10 @@ class _BrnLayerMoreSelectionPageState extends State } Widget _buildRightItem(int index) { - bool isSingle = - (_currentFirstEntity?.children[index].filterType == BrnSelectionFilterType.radio) || - (_currentFirstEntity?.children[index].filterType == BrnSelectionFilterType.unLimit); + bool isSingle = (_currentFirstEntity?.children[index].filterType == + BrnSelectionFilterType.radio) || + (_currentFirstEntity?.children[index].filterType == + BrnSelectionFilterType.unLimit); return GestureDetector( onTap: () { @@ -431,8 +444,9 @@ class _BrnLayerMoreSelectionPageState extends State height: 16, width: 16, child: entity.isSelected - ? BrunoTools.getAssetImageWithBandColor(BrnAsset.selectCheckedStatus) - : BrunoTools.getAssetImage(BrnAsset.iconUnSelect), + ? BrunoTools.getAssetImageWithBandColor( + BrnAsset.selectCheckedStatus) + : BrunoTools.getAssetImage(BrnAsset.iconUnSelect), ) ], ); diff --git a/lib/src/components/selection/widget/brn_selection_animate_widget.dart b/lib/src/components/selection/widget/brn_selection_animate_widget.dart index 88516ae1..7cd9c1cd 100644 --- a/lib/src/components/selection/widget/brn_selection_animate_widget.dart +++ b/lib/src/components/selection/widget/brn_selection_animate_widget.dart @@ -16,10 +16,12 @@ class BrnSelectionAnimationWidget extends StatefulWidget { }) : super(key: key); @override - _BrnSelectionAnimationWidgetState createState() => _BrnSelectionAnimationWidgetState(); + _BrnSelectionAnimationWidgetState createState() => + _BrnSelectionAnimationWidgetState(); } -class _BrnSelectionAnimationWidgetState extends State +class _BrnSelectionAnimationWidgetState + extends State with SingleTickerProviderStateMixin { bool _isControllerDisposed = false; late AnimationController _animationController; @@ -29,7 +31,8 @@ class _BrnSelectionAnimationWidgetState extends State animation = Tween( begin: 0.0, - end: MediaQuery.of(context).size.height - (widget.controller.listViewTop ?? 0)) + end: MediaQuery.of(context).size.height - + (widget.controller.listViewTop ?? 0)) .animate(_animationController) ..addListener(() { //这行如果不写,没有动画效果 @@ -78,7 +83,8 @@ class _BrnSelectionAnimationWidgetState extends State f.isSelected && !f.isUnLimit()).length; + if ((BrnSelectionUtil.getTotalLevel(item) < 3 || !isFirstLevel) && + item.children.isNotEmpty) { + int count = + item.children.where((f) => f.isSelected && !f.isUnLimit()).length; if (count > 1) { return '($count)'; } else if (count == 1 && item.hasCheckBoxBrother()) { return '($count)'; } else { - var unLimited = item.children.where((f) => f.isSelected && f.isUnLimit()).toList(); + var unLimited = + item.children.where((f) => f.isSelected && f.isUnLimit()).toList(); if (unLimited.length > 0) { return '(全部)'; } diff --git a/lib/src/components/selection/widget/brn_selection_date_range_item_widget.dart b/lib/src/components/selection/widget/brn_selection_date_range_item_widget.dart index e00fea96..f789193c 100644 --- a/lib/src/components/selection/widget/brn_selection_date_range_item_widget.dart +++ b/lib/src/components/selection/widget/brn_selection_date_range_item_widget.dart @@ -47,27 +47,36 @@ class BrnSelectionDateRangeItemWidget extends StatefulWidget { required this.themeData}) : super(key: key); - _BrnSelectionDateRangeItemWidgetState createState() => _BrnSelectionDateRangeItemWidgetState(); + _BrnSelectionDateRangeItemWidgetState createState() => + _BrnSelectionDateRangeItemWidgetState(); } -class _BrnSelectionDateRangeItemWidgetState extends State { - BrnSelectionDatePickerController _datePickerController = BrnSelectionDatePickerController(); +class _BrnSelectionDateRangeItemWidgetState + extends State { + BrnSelectionDatePickerController _datePickerController = + BrnSelectionDatePickerController(); @override void initState() { var minDateTime; - if (widget.item.customMap != null && widget.item.customMap!['min'] != null) { - minDateTime = DateTimeFormatter.convertIntValueToDateTime(widget.item.customMap!['min']); + if (widget.item.customMap != null && + widget.item.customMap!['min'] != null) { + minDateTime = DateTimeFormatter.convertIntValueToDateTime( + widget.item.customMap!['min']); } var maxDateTime; - if (widget.item.customMap != null && widget.item.customMap!['max'] != null) { - maxDateTime = DateTimeFormatter.convertIntValueToDateTime(widget.item.customMap!['max']); + if (widget.item.customMap != null && + widget.item.customMap!['max'] != null) { + maxDateTime = DateTimeFormatter.convertIntValueToDateTime( + widget.item.customMap!['max']); } widget.minTextEditingController.text = minDateTime != null - ? DateTimeFormatter.formatDate(minDateTime, widget.dateFormat, DateTimePickerLocale.zh_cn) + ? DateTimeFormatter.formatDate( + minDateTime, widget.dateFormat, DateTimePickerLocale.zh_cn) : ''; widget.maxTextEditingController.text = maxDateTime != null - ? DateTimeFormatter.formatDate(maxDateTime, widget.dateFormat, DateTimePickerLocale.zh_cn) + ? DateTimeFormatter.formatDate( + maxDateTime, widget.dateFormat, DateTimePickerLocale.zh_cn) : ''; super.initState(); } @@ -86,7 +95,8 @@ class _BrnSelectionDateRangeItemWidgetState extends State { widgetList.add(_listWidget()); // TODO 判断是否添加 Bottom - if (totalLevel == 1 && widget.entity.filterType == BrnSelectionFilterType.radio) { + if (totalLevel == 1 && + widget.entity.filterType == BrnSelectionFilterType.radio) { } else { widgetList.add(_bottomWidget()); } @@ -115,9 +117,11 @@ class _BrnSelectionGroupViewState extends State { maxHeight: widget.maxContentHeight, flex: _getFlexByListIndex(1), focusedIndex: _firstIndex, - singleListItemSelect: (int listIndex, int index, BrnSelectionEntity entity) { + singleListItemSelect: + (int listIndex, int index, BrnSelectionEntity entity) { _setFirstIndex(index); - if (totalLevel == 1 && widget.entity.filterType == BrnSelectionFilterType.radio) { + if (totalLevel == 1 && + widget.entity.filterType == BrnSelectionFilterType.radio) { _confirmButtonClickEvent(); } })); @@ -132,7 +136,8 @@ class _BrnSelectionGroupViewState extends State { selectedBackgroundColor: _getSelectBgByListIndex(1), flex: _getFlexByListIndex(1), focusedIndex: _firstIndex, - singleListItemSelect: (int listIndex, int index, BrnSelectionEntity entity) { + singleListItemSelect: + (int listIndex, int index, BrnSelectionEntity entity) { _setFirstIndex(index); })); @@ -143,7 +148,8 @@ class _BrnSelectionGroupViewState extends State { selectedBackgroundColor: _getSelectBgByListIndex(2), flex: _getFlexByListIndex(2), focusedIndex: _secondIndex, - singleListItemSelect: (int listIndex, int index, BrnSelectionEntity entity) { + singleListItemSelect: + (int listIndex, int index, BrnSelectionEntity entity) { _setSecondIndex(index); })); } else if (!BrunoTools.isEmpty(_firstList) && @@ -157,7 +163,8 @@ class _BrnSelectionGroupViewState extends State { selectedBackgroundColor: _getSelectBgByListIndex(1), flex: _getFlexByListIndex(1), focusedIndex: _firstIndex, - singleListItemSelect: (int listIndex, int index, BrnSelectionEntity entity) { + singleListItemSelect: + (int listIndex, int index, BrnSelectionEntity entity) { _setFirstIndex(index); })); @@ -168,7 +175,8 @@ class _BrnSelectionGroupViewState extends State { selectedBackgroundColor: _getSelectBgByListIndex(2), flex: _getFlexByListIndex(2), focusedIndex: _secondIndex, - singleListItemSelect: (int listIndex, int index, BrnSelectionEntity entity) { + singleListItemSelect: + (int listIndex, int index, BrnSelectionEntity entity) { _setSecondIndex(index); })); widgets.add(BrnSelectionSingleListWidget( @@ -178,7 +186,8 @@ class _BrnSelectionGroupViewState extends State { selectedBackgroundColor: _getSelectBgByListIndex(3), flex: _getFlexByListIndex(3), focusedIndex: _thirdIndex, - singleListItemSelect: (int listIndex, int index, BrnSelectionEntity entity) { + singleListItemSelect: + (int listIndex, int index, BrnSelectionEntity entity) { if (entity.isSelected) { _thirdIndex = index; } else { @@ -247,11 +256,13 @@ class _BrnSelectionGroupViewState extends State { Container( height: 24, width: 24, - child: BrunoTools.getAssetImage(BrnAsset.iconSelectionReset), + child: BrunoTools.getAssetImage( + BrnAsset.iconSelectionReset), ), Text( "重置", - style: widget.themeData.resetTextStyle.generateTextStyle(), + style: + widget.themeData.resetTextStyle.generateTextStyle(), ) ], ), @@ -282,7 +293,8 @@ class _BrnSelectionGroupViewState extends State { _processFilterDataOnConfirm(); if (widget.onSelectionConfirm != null) { //更多和无tips等外部调用的多选需要传递此值selectedLastColumnArray - widget.onSelectionConfirm!(widget.entity, _firstIndex, _secondIndex, _thirdIndex); + widget.onSelectionConfirm!( + widget.entity, _firstIndex, _secondIndex, _thirdIndex); } } @@ -387,12 +399,13 @@ class _BrnSelectionGroupViewState extends State { commonEntity.customMap = Map.from(commonEntity.originalCustomMap); } } - + void _setFirstIndex(int firstIndex) { _firstIndex = firstIndex; _secondIndex = -1; if (widget.entity.children.length > _firstIndex) { - List seconds = widget.entity.children[_firstIndex].children; + List seconds = + widget.entity.children[_firstIndex].children; _secondIndex = _getInitialSelectIndex(seconds); if (_secondIndex >= 0) { _setSecondIndex(_secondIndex); @@ -406,7 +419,8 @@ class _BrnSelectionGroupViewState extends State { void _setSecondIndex(int secondIndex) { _secondIndex = secondIndex; _thirdIndex = -1; - List seconds = widget.entity.children[_firstIndex].children; + List seconds = + widget.entity.children[_firstIndex].children; if (seconds.length > _secondIndex) { List thirds = seconds[_secondIndex].children; if (thirds.isNotEmpty) { @@ -544,7 +558,8 @@ class _BrnSelectionGroupViewState extends State { if (entity.children.length > 0) { entity.children.forEach((f) => _processSelectedStatus(f)); if (entity.hasCheckBoxBrother()) { - entity.isSelected = entity.children.where((_) => _.isSelected).length > 0; + entity.isSelected = + entity.children.where((_) => _.isSelected).length > 0; } } } diff --git a/lib/src/components/selection/widget/brn_selection_menu_widget.dart b/lib/src/components/selection/widget/brn_selection_menu_widget.dart index b7a9d332..18a0a187 100644 --- a/lib/src/components/selection/widget/brn_selection_menu_widget.dart +++ b/lib/src/components/selection/widget/brn_selection_menu_widget.dart @@ -17,8 +17,8 @@ import 'package:flutter/material.dart'; typedef bool BrnOnMenuItemClick(int index); -typedef void BrnOnRangeSelectionConfirm( - BrnSelectionEntity results, int firstIndex, int secondIndex, int thirdIndex); +typedef void BrnOnRangeSelectionConfirm(BrnSelectionEntity results, + int firstIndex, int secondIndex, int thirdIndex); class BrnSelectionMenuWidget extends StatefulWidget { final List data; @@ -38,7 +38,8 @@ class BrnSelectionMenuWidget extends StatefulWidget { final BrnSelectionConfig themeData; BrnSelectionMenuWidget( - { Key? key,required this.context, + {Key? key, + required this.context, required this.data, this.height = 50.0, this.width, @@ -47,7 +48,8 @@ class BrnSelectionMenuWidget extends StatefulWidget { this.configRowCount, this.extraScrollController, this.constantTop, - required this.themeData}): super(key: key); + required this.themeData}) + : super(key: key); @override _BrnSelectionMenuWidgetState createState() => _BrnSelectionMenuWidgetState(); @@ -59,7 +61,8 @@ class _BrnSelectionMenuWidgetState extends State { List titles = []; List menuItemActiveState = []; List menuItemHighlightState = []; - BrnSelectionListViewController listViewController = BrnSelectionListViewController(); + BrnSelectionListViewController listViewController = + BrnSelectionListViewController(); ScrollController? _scrollController; late StreamSubscription _refreshTitleSubscription; @@ -69,14 +72,16 @@ class _BrnSelectionMenuWidgetState extends State { @override void initState() { super.initState(); - _refreshTitleSubscription = - EventBus.instance.on().listen((RefreshMenuTitleEvent event) { + _refreshTitleSubscription = EventBus.instance + .on() + .listen((RefreshMenuTitleEvent event) { _needRefreshTitle = true; setState(() {}); }); - _closeSelectionPopupWindowSubscription = - EventBus.instance.on().listen((CloseSelectionViewEvent event) { + _closeSelectionPopupWindowSubscription = EventBus.instance + .on() + .listen((CloseSelectionViewEvent event) { _closeSelectionPopupWindow(); }); @@ -120,7 +125,9 @@ class _BrnSelectionMenuWidgetState extends State { /// 根据【Filter组】 创建 widget。 OverlayEntry _createEntry(BrnSelectionEntity entity) { - var content = _isRange(entity) ? _createRangeView(entity) : _createSelectionListView(entity); + var content = _isRange(entity) + ? _createRangeView(entity) + : _createSelectionListView(entity); return OverlayEntry(builder: (context) { return GestureDetector( onTap: () { @@ -132,7 +139,8 @@ class _BrnSelectionMenuWidgetState extends State { ), child: Stack( children: [ - BrnSelectionAnimationWidget(controller: listViewController, view: content) + BrnSelectionAnimationWidget( + controller: listViewController, view: content) ], ), ), @@ -144,7 +152,9 @@ class _BrnSelectionMenuWidgetState extends State { Widget build(BuildContext context) { return Container( height: widget.height, - width: (widget.width != null) ? widget.width : MediaQuery.of(context).size.width, + width: (widget.width != null) + ? widget.width + : MediaQuery.of(context).size.width, color: Colors.white, child: Column( mainAxisAlignment: MainAxisAlignment.start, @@ -187,7 +197,8 @@ class _BrnSelectionMenuWidgetState extends State { title: titles[index], themeData: widget.themeData, active: menuItemActiveState[index], - isHighLight: menuItemActiveState[index] || menuItemHighlightState[index], + isHighLight: + menuItemActiveState[index] || menuItemHighlightState[index], itemClickFunction: () { if (widget.onMenuItemClick != null) { /// 拦截 menuItem 点击。 @@ -196,14 +207,17 @@ class _BrnSelectionMenuWidgetState extends State { } } RenderBox? dropDownItemRenderBox; - if (context.findRenderObject() != null && context.findRenderObject() is RenderBox) { + if (context.findRenderObject() != null && + context.findRenderObject() is RenderBox) { dropDownItemRenderBox = context.findRenderObject() as RenderBox; } - Offset? position = dropDownItemRenderBox?.localToGlobal(Offset.zero, ancestor: null); + Offset? position = + dropDownItemRenderBox?.localToGlobal(Offset.zero, ancestor: null); Size? size = dropDownItemRenderBox?.size; listViewController.listViewTop = (size?.height ?? 0) + (widget.constantTop ?? position?.dy ?? 0); - if (listViewController.isShow && listViewController.menuIndex != index) { + if (listViewController.isShow && + listViewController.menuIndex != index) { listViewController.hide(); } @@ -212,14 +226,16 @@ class _BrnSelectionMenuWidgetState extends State { } else { /// 点击不是 More、自定义类型,则直接展开。 if (widget.data[index].filterType != BrnSelectionFilterType.more && - widget.data[index].filterType != BrnSelectionFilterType.customHandle) { + widget.data[index].filterType != + BrnSelectionFilterType.customHandle) { /// 创建 筛选组件的的入口 OverlayEntry entry = _createEntry(widget.data[index]); Overlay.of(widget.context)?.insert(entry); listViewController.entry = entry; listViewController.show(index); - } else if (widget.data[index].filterType == BrnSelectionFilterType.customHandle) { + } else if (widget.data[index].filterType == + BrnSelectionFilterType.customHandle) { /// 记录自定义筛选 menu 的点击状态,当点击自定义的 menu 时,menu 文案默认高亮。 listViewController.show(index); _refreshSelectionMenuTitle(index, widget.data[index]); @@ -261,7 +277,8 @@ class _BrnSelectionMenuWidgetState extends State { return true; } var totalLevel = BrnSelectionUtil.getTotalLevel(entity); - if (totalLevel == 1 && entity.filterType == BrnSelectionFilterType.checkbox) { + if (totalLevel == 1 && + entity.filterType == BrnSelectionFilterType.checkbox) { return true; } return false; @@ -270,13 +287,15 @@ class _BrnSelectionMenuWidgetState extends State { Widget _createRangeView(BrnSelectionEntity entity) { int? rowCount; if (widget.configRowCount != null) { - rowCount = widget.configRowCount!(widget.data.indexOf(entity), entity) ?? rowCount; + rowCount = widget.configRowCount!(widget.data.indexOf(entity), entity) ?? + rowCount; } return BrnRangeSelectionGroupWidget( entity: entity, marginTop: listViewController.listViewTop ?? 0, - maxContentHeight: - DESIGN_SELECTION_HEIGHT / DESIGN_SCREEN_HEIGHT * MediaQuery.of(context).size.height, + maxContentHeight: DESIGN_SELECTION_HEIGHT / + DESIGN_SCREEN_HEIGHT * + MediaQuery.of(context).size.height, // UI 给出的内容高度比例 248:812 themeData: widget.themeData, rowCount: rowCount, @@ -289,8 +308,8 @@ class _BrnSelectionMenuWidgetState extends State { listViewController.hide(); }); }, - onSelectionConfirm: - (BrnSelectionEntity result, int firstIndex, int secondIndex, int thirdIndex) { + onSelectionConfirm: (BrnSelectionEntity result, int firstIndex, + int secondIndex, int thirdIndex) { setState(() { _onConfirmSelect(entity, result, firstIndex, secondIndex, thirdIndex); }); @@ -302,8 +321,9 @@ class _BrnSelectionMenuWidgetState extends State { /// 顶层筛选 Tab return BrnListSelectionGroupWidget( entity: entity, - maxContentHeight: - DESIGN_SELECTION_HEIGHT / DESIGN_SCREEN_HEIGHT * MediaQuery.of(context).size.height, + maxContentHeight: DESIGN_SELECTION_HEIGHT / + DESIGN_SCREEN_HEIGHT * + MediaQuery.of(context).size.height, themeData: widget.themeData, // UI 给出的内容高度比例 248:812 bgClickFunction: () { @@ -315,8 +335,8 @@ class _BrnSelectionMenuWidgetState extends State { listViewController.hide(); }); }, - onSelectionConfirm: - (BrnSelectionEntity result, int firstIndex, int secondIndex, int thirdIndex) { + onSelectionConfirm: (BrnSelectionEntity result, int firstIndex, + int secondIndex, int thirdIndex) { setState(() { _onConfirmSelect(entity, result, firstIndex, secondIndex, thirdIndex); }); @@ -324,8 +344,8 @@ class _BrnSelectionMenuWidgetState extends State { ); } - void _onConfirmSelect(BrnSelectionEntity entity, BrnSelectionEntity result, int firstIndex, - int secondIndex, int thirdIndex) { + void _onConfirmSelect(BrnSelectionEntity entity, BrnSelectionEntity result, + int firstIndex, int secondIndex, int thirdIndex) { if (listViewController.menuIndex < titles.length) { if (widget.onConfirm != null) { widget.onConfirm!(result, firstIndex, secondIndex, thirdIndex); @@ -351,15 +371,18 @@ class _BrnSelectionMenuWidgetState extends State { String? _getTitle(BrnSelectionEntity entity) { String? title; - List firstColumn = BrnSelectionUtil.currentSelectListForEntity(entity); + List firstColumn = + BrnSelectionUtil.currentSelectListForEntity(entity); List secondColumn = []; List thirdColumn = []; if (firstColumn.length > 0) { for (BrnSelectionEntity firstEntity in firstColumn) { - secondColumn.addAll(BrnSelectionUtil.currentSelectListForEntity(firstEntity)); + secondColumn + .addAll(BrnSelectionUtil.currentSelectListForEntity(firstEntity)); if (secondColumn.length > 0) { for (BrnSelectionEntity secondEntity in secondColumn) { - thirdColumn.addAll(BrnSelectionUtil.currentSelectListForEntity(secondEntity)); + thirdColumn.addAll( + BrnSelectionUtil.currentSelectListForEntity(secondEntity)); } } } @@ -374,7 +397,8 @@ class _BrnSelectionMenuWidgetState extends State { } else if (firstColumn[0].filterType == BrnSelectionFilterType.range || firstColumn[0].filterType == BrnSelectionFilterType.date || firstColumn[0].filterType == BrnSelectionFilterType.dateRange || - firstColumn[0].filterType == BrnSelectionFilterType.dateRangeCalendar) { + firstColumn[0].filterType == + BrnSelectionFilterType.dateRangeCalendar) { title = _getDateAndRangeTitle(firstColumn, entity); } else { if (secondColumn.length == 0 || secondColumn.length > 1) { @@ -383,10 +407,12 @@ class _BrnSelectionMenuWidgetState extends State { /// 第二列选中了一个,为【不限】类型,使用上一级别的名字展示。 if (secondColumn[0].isUnLimit()) { title = firstColumn[0].title; - } else if (secondColumn[0].filterType == BrnSelectionFilterType.range || + } else if (secondColumn[0].filterType == + BrnSelectionFilterType.range || secondColumn[0].filterType == BrnSelectionFilterType.date || secondColumn[0].filterType == BrnSelectionFilterType.dateRange || - secondColumn[0].filterType == BrnSelectionFilterType.dateRangeCalendar) { + secondColumn[0].filterType == + BrnSelectionFilterType.dateRangeCalendar) { title = _getDateAndRangeTitle(secondColumn, firstColumn[0]); } else { if (thirdColumn.length == 0 || thirdColumn.length > 1) { @@ -395,10 +421,13 @@ class _BrnSelectionMenuWidgetState extends State { /// 第三列选中了一个,为【不限】类型,使用上一级别的名字展示。 if (thirdColumn[0].isUnLimit()) { title = secondColumn[0].title; - } else if (thirdColumn[0].filterType == BrnSelectionFilterType.range || + } else if (thirdColumn[0].filterType == + BrnSelectionFilterType.range || thirdColumn[0].filterType == BrnSelectionFilterType.date || - thirdColumn[0].filterType == BrnSelectionFilterType.dateRange || - thirdColumn[0].filterType == BrnSelectionFilterType.dateRangeCalendar) { + thirdColumn[0].filterType == + BrnSelectionFilterType.dateRange || + thirdColumn[0].filterType == + BrnSelectionFilterType.dateRangeCalendar) { title = _getDateAndRangeTitle(thirdColumn, secondColumn[0]); } else { title = thirdColumn[0].title; @@ -408,12 +437,14 @@ class _BrnSelectionMenuWidgetState extends State { } } } - String joinTitle = _getJoinTitle(entity, firstColumn, secondColumn, thirdColumn); + String joinTitle = + _getJoinTitle(entity, firstColumn, secondColumn, thirdColumn); title = BrunoTools.isEmpty(joinTitle) ? title : joinTitle; return title; } - String? _getDateAndRangeTitle(List list, BrnSelectionEntity entity) { + String? _getDateAndRangeTitle( + List list, BrnSelectionEntity entity) { String? title = ''; if (!BrunoTools.isEmpty(list[0].customMap)) { if (list[0].filterType == BrnSelectionFilterType.range) { @@ -440,19 +471,21 @@ class _BrnSelectionMenuWidgetState extends State { if (list[0].customMap != null && list[0].customMap!['min'] != null && int.tryParse(list[0].customMap!['min'] ?? '') != null) { - DateTime? minDate = DateTimeFormatter.convertIntValueToDateTime(list[0].customMap!['min']); + DateTime? minDate = DateTimeFormatter.convertIntValueToDateTime( + list[0].customMap!['min']); if (minDate != null) { - minDateTime = - DateTimeFormatter.formatDate(minDate, 'yyyy年MM月dd日', DateTimePickerLocale.zh_cn); + minDateTime = DateTimeFormatter.formatDate( + minDate, 'yyyy年MM月dd日', DateTimePickerLocale.zh_cn); } } if (list[0].customMap != null && list[0].customMap!['max'] != null && int.tryParse(list[0].customMap!['max'] ?? '') != null) { - DateTime? maxDate = DateTimeFormatter.convertIntValueToDateTime(list[0].customMap!['max']); + DateTime? maxDate = DateTimeFormatter.convertIntValueToDateTime( + list[0].customMap!['max']); if (maxDate != null) { - maxDateTime = - DateTimeFormatter.formatDate(maxDate, 'yyyy年MM月dd日', DateTimePickerLocale.zh_cn); + maxDateTime = DateTimeFormatter.formatDate( + maxDate, 'yyyy年MM月dd日', DateTimePickerLocale.zh_cn); } } return '$minDateTime-$maxDateTime'; @@ -462,14 +495,19 @@ class _BrnSelectionMenuWidgetState extends State { String? title = ""; int? msDateTime = int.tryParse(list[0].value ?? ''); title = msDateTime != null - ? DateTimeFormatter.formatDate(DateTime.fromMillisecondsSinceEpoch(msDateTime), - 'yyyy年MM月dd日', DateTimePickerLocale.zh_cn) + ? DateTimeFormatter.formatDate( + DateTime.fromMillisecondsSinceEpoch(msDateTime), + 'yyyy年MM月dd日', + DateTimePickerLocale.zh_cn) : list[0].title; return title; } - String _getJoinTitle(BrnSelectionEntity entity, List firstColumn, - List secondColumn, List thirdColumn) { + String _getJoinTitle( + BrnSelectionEntity entity, + List firstColumn, + List secondColumn, + List thirdColumn) { String title = ""; if (entity.canJoinTitle) { if (firstColumn.length == 1) { diff --git a/lib/src/components/selection/widget/brn_selection_more_item_widget.dart b/lib/src/components/selection/widget/brn_selection_more_item_widget.dart index 528b7d36..dddc1aa1 100644 --- a/lib/src/components/selection/widget/brn_selection_more_item_widget.dart +++ b/lib/src/components/selection/widget/brn_selection_more_item_widget.dart @@ -49,7 +49,8 @@ class _BrnMoreSelectionWidgetState extends State { Widget build(BuildContext context) { //弹出浮层 if (widget.selectionEntity.filterType == BrnSelectionFilterType.layer || - widget.selectionEntity.filterType == BrnSelectionFilterType.customLayer) { + widget.selectionEntity.filterType == + BrnSelectionFilterType.customLayer) { return FilterLayerTypeWidget( selectionEntity: widget.selectionEntity, onCustomFloatingLayerClick: widget.onCustomFloatingLayerClick, @@ -80,7 +81,8 @@ class _FilterCommonTypeWidget extends StatefulWidget { }) : super(key: key); @override - __FilterCommonTypeWidgetState createState() => __FilterCommonTypeWidgetState(); + __FilterCommonTypeWidgetState createState() => + __FilterCommonTypeWidgetState(); } class __FilterCommonTypeWidgetState extends State<_FilterCommonTypeWidget> { @@ -132,14 +134,18 @@ class __FilterCommonTypeWidgetState extends State<_FilterCommonTypeWidget> { crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( - padding: EdgeInsets.only(top: 20, right: _isVisibleMore() ? 40 : 0), + padding: + EdgeInsets.only(top: 20, right: _isVisibleMore() ? 40 : 0), child: _buildTitleWidget(), ), //自定义输入框 _buildRangeWidget(), //标签的筛选条件 Visibility( - visible: widget.selectionEntity.currentShowTagByExpanded(isExpanded).length > 0, + visible: widget.selectionEntity + .currentShowTagByExpanded(isExpanded) + .length > + 0, child: Padding( padding: EdgeInsets.only(top: 12), child: _buildSelectionTag(), @@ -256,9 +262,12 @@ class __FilterCommonTypeWidgetState extends State<_FilterCommonTypeWidget> { if (BrunoTools.isEmpty(entity.value)) { showName = entity.title; } else { - int time = int.tryParse(entity.value ?? "") ?? DateTime.now().millisecondsSinceEpoch; + int time = int.tryParse(entity.value ?? "") ?? + DateTime.now().millisecondsSinceEpoch; showName = DateTimeFormatter.formatDate( - DateTime.fromMillisecondsSinceEpoch(time), 'yyyy/MMMM/dd', DateTimePickerLocale.zh_cn); + DateTime.fromMillisecondsSinceEpoch(time), + 'yyyy/MMMM/dd', + DateTimePickerLocale.zh_cn); } } else { showName = entity.title; @@ -289,7 +298,8 @@ class __FilterCommonTypeWidgetState extends State<_FilterCommonTypeWidget> { } void _showDatePicker(BrnSelectionEntity data) { - int time = int.tryParse(data.value ?? "") ?? DateTime.now().millisecondsSinceEpoch; + int time = + int.tryParse(data.value ?? "") ?? DateTime.now().millisecondsSinceEpoch; BrnDatePicker.showDatePicker(context, pickerMode: BrnDateTimePickerMode.date, pickerTitleConfig: BrnPickerTitleConfig.Default, @@ -425,7 +435,8 @@ class __MoreRangeWidgetState extends State<_MoreRangeWidget> { maxController.text = widget.rangeEntity.customMap!['max']?.toString() ?? ''; min = int.tryParse(widget.rangeEntity.extMap['min']?.toString() ?? "") ?? 0; - max = int.tryParse(widget.rangeEntity.extMap['max']?.toString() ?? "") ?? 9999; + max = int.tryParse(widget.rangeEntity.extMap['max']?.toString() ?? "") ?? + 9999; ///处理的逻辑: /// 1:将输入框的 文本写入 customMap中 @@ -464,13 +475,15 @@ class __MoreRangeWidgetState extends State<_MoreRangeWidget> { /// 如果是多选 则不处理 minFocusNode.addListener(() { if (minFocusNode.hasFocus) { - widget.streamController?.add(InputEvent(filter: false, rangeEntity: widget.rangeEntity)); + widget.streamController + ?.add(InputEvent(filter: false, rangeEntity: widget.rangeEntity)); } }); maxFocusNode.addListener(() { if (maxFocusNode.hasFocus) { - widget.streamController?.add(InputEvent(filter: false, rangeEntity: widget.rangeEntity)); + widget.streamController + ?.add(InputEvent(filter: false, rangeEntity: widget.rangeEntity)); } }); @@ -501,14 +514,16 @@ class __MoreRangeWidgetState extends State<_MoreRangeWidget> { themeData: widget.themeData, onTapped: () { //点击选择框通知标签清空 - widget.streamController?.add(InputEvent(filter: false, rangeEntity: widget.rangeEntity)); + widget.streamController?.add( + InputEvent(filter: false, rangeEntity: widget.rangeEntity)); }); } else { return Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( - child: _buildRangeField('最小值', minController, minFocusNode, widget.themeData), + child: _buildRangeField( + '最小值', minController, minFocusNode, widget.themeData), ), Container( // height: 38, @@ -520,7 +535,8 @@ class __MoreRangeWidgetState extends State<_MoreRangeWidget> { ), ), Expanded( - child: _buildRangeField('最大值', maxController, maxFocusNode, widget.themeData), + child: _buildRangeField( + '最大值', maxController, maxFocusNode, widget.themeData), ), ], ); @@ -539,20 +555,27 @@ class __MoreRangeWidgetState extends State<_MoreRangeWidget> { focusNode: focusNode, textAlign: TextAlign.center, controller: textEditingController, - cursorColor: BrnThemeConfigurator.instance.getConfig().commonConfig.brandPrimary, + cursorColor: BrnThemeConfigurator.instance + .getConfig() + .commonConfig + .brandPrimary, inputFormatters: [FilteringTextInputFormatter.digitsOnly], style: widget.themeData.inputTextStyle.generateTextStyle(), decoration: InputDecoration( hintText: hint, hintStyle: widget.themeData.hintTextStyle.generateTextStyle(), enabledBorder: UnderlineInputBorder( - borderRadius: BorderRadius.circular(widget.themeData.tagRadius), - borderSide: - BorderSide(width: 1, color: widget.themeData.commonConfig.borderColorBase)), + borderRadius: + BorderRadius.circular(widget.themeData.tagRadius), + borderSide: BorderSide( + width: 1, + color: widget.themeData.commonConfig.borderColorBase)), focusedBorder: UnderlineInputBorder( - borderRadius: BorderRadius.circular(widget.themeData.tagRadius), - borderSide: - BorderSide(width: 1, color: widget.themeData.commonConfig.borderColorBase))), + borderRadius: + BorderRadius.circular(widget.themeData.tagRadius), + borderSide: BorderSide( + width: 1, + color: widget.themeData.commonConfig.borderColorBase))), ), ), ); @@ -594,7 +617,8 @@ class _FilterLayerTypeWidgetState extends State { padding: const EdgeInsets.only(left: 20, right: 20, top: 6), child: GestureDetector( onTap: () { - if (widget.selectionEntity.filterType == BrnSelectionFilterType.layer) { + if (widget.selectionEntity.filterType == + BrnSelectionFilterType.layer) { Navigator.of(context) .push(PageRouteBuilder( opaque: false, @@ -607,18 +631,21 @@ class _FilterLayerTypeWidgetState extends State { .then((data) { setState(() {}); }); - } else if (widget.selectionEntity.filterType == BrnSelectionFilterType.customLayer) { + } else if (widget.selectionEntity.filterType == + BrnSelectionFilterType.customLayer) { if (widget.onCustomFloatingLayerClick != null) { int entityIndex = -1; if (widget.selectionEntity.parent != null) { - entityIndex = - widget.selectionEntity.parent!.children.indexOf(widget.selectionEntity); + entityIndex = widget.selectionEntity.parent!.children + .indexOf(widget.selectionEntity); } - widget.onCustomFloatingLayerClick!(entityIndex, widget.selectionEntity, + widget.onCustomFloatingLayerClick!( + entityIndex, widget.selectionEntity, (List customFloatingLayerParams) { widget.selectionEntity.children.clear(); widget.selectionEntity.children = []; - widget.selectionEntity.children.addAll(customFloatingLayerParams); + widget.selectionEntity.children + .addAll(customFloatingLayerParams); widget.selectionEntity.configDefaultValue(); setState(() {}); }); @@ -632,7 +659,8 @@ class _FilterLayerTypeWidgetState extends State { child: Text(_isEmptyCondition() ? '请选择' : _getCondition(), style: _isEmptyCondition() ? widget.themeData.hintTextStyle.generateTextStyle() - : widget.themeData.optionTextStyle.generateTextStyle()), + : widget.themeData.optionTextStyle + .generateTextStyle()), ), Container( height: 16, @@ -655,7 +683,8 @@ class _FilterLayerTypeWidgetState extends State { String _getCondition() { String tmp = ""; //返回所有选中的 - List selectedList = widget.selectionEntity.selectedList(); + List selectedList = + widget.selectionEntity.selectedList(); //判断步骤: //第一步:取出来所有选中的: 房山 不限 小白楼 西城 不限 diff --git a/lib/src/components/selection/widget/brn_selection_range_input_item_widget.dart b/lib/src/components/selection/widget/brn_selection_range_input_item_widget.dart index baecf63f..0372558d 100644 --- a/lib/src/components/selection/widget/brn_selection_range_input_item_widget.dart +++ b/lib/src/components/selection/widget/brn_selection_range_input_item_widget.dart @@ -32,12 +32,14 @@ class BrnSelectionRangeItemWidget extends StatefulWidget { this.onRangeChanged, this.onFocusChanged, required this.themeData, - }): super(key: key); + }) : super(key: key); - _BrnSelectionRangeItemWidgetState createState() => _BrnSelectionRangeItemWidgetState(); + _BrnSelectionRangeItemWidgetState createState() => + _BrnSelectionRangeItemWidgetState(); } -class _BrnSelectionRangeItemWidgetState extends State { +class _BrnSelectionRangeItemWidgetState + extends State { FocusNode _minFocusNode = FocusNode(); FocusNode _maxFocusNode = FocusNode(); @@ -55,13 +57,15 @@ class _BrnSelectionRangeItemWidgetState extends State().listen((ClearSelectionFocusEvent event) { + EventBus.instance + .on() + .listen((ClearSelectionFocusEvent event) { _minFocusNode.unfocus(); _maxFocusNode.unfocus(); }); @@ -139,7 +145,9 @@ class _BrnSelectionRangeItemWidgetState extends State _BrnSelectionRangeTagWidgetState(); + _BrnSelectionRangeTagWidgetState createState() => + _BrnSelectionRangeTagWidgetState(); } -class _BrnSelectionRangeTagWidgetState extends State { +class _BrnSelectionRangeTagWidgetState + extends State { @override Widget build(BuildContext context) { return Wrap( @@ -57,7 +59,9 @@ class _BrnSelectionRangeTagWidgetState extends State List _tagWidgetList(context) { List list = []; - for (int nameIndex = 0; nameIndex < widget.tagFilterList.length; nameIndex++) { + for (int nameIndex = 0; + nameIndex < widget.tagFilterList.length; + nameIndex++) { Widget tagWidget = _tagWidgetAtIndex(nameIndex); GestureDetector gdt = GestureDetector( child: tagWidget, @@ -82,23 +86,26 @@ class _BrnSelectionRangeTagWidgetState extends State } Widget _tagWidgetAtIndex(int nameIndex) { - bool selected = - widget.tagFilterList[nameIndex].isSelected || nameIndex == widget.initFocusedIndex; + bool selected = widget.tagFilterList[nameIndex].isSelected || + nameIndex == widget.initFocusedIndex; String text = widget.tagFilterList[nameIndex].title; - if (widget.tagFilterList[nameIndex].filterType == BrnSelectionFilterType.date && + if (widget.tagFilterList[nameIndex].filterType == + BrnSelectionFilterType.date && !BrunoTools.isEmpty(widget.tagFilterList[nameIndex].value)) { if (int.tryParse(widget.tagFilterList[nameIndex].value ?? '') != null) { - DateTime? dateTime = - DateTimeFormatter.convertIntValueToDateTime(widget.tagFilterList[nameIndex].value); + DateTime? dateTime = DateTimeFormatter.convertIntValueToDateTime( + widget.tagFilterList[nameIndex].value); if (dateTime != null) { - text = DateTimeFormatter.formatDate(dateTime, 'yyyy年MM月dd日', DateTimePickerLocale.zh_cn); + text = DateTimeFormatter.formatDate( + dateTime, 'yyyy年MM月dd日', DateTimePickerLocale.zh_cn); } } else { text = widget.tagFilterList[nameIndex].value ?? ''; } } - Text tx = Text(text, style: selected ? _selectedTextStyle() : _tagTextStyle()); + Text tx = + Text(text, style: selected ? _selectedTextStyle() : _tagTextStyle()); Container tagItem = Container( alignment: Alignment.center, decoration: BoxDecoration( diff --git a/lib/src/components/selection/widget/brn_selection_range_widget.dart b/lib/src/components/selection/widget/brn_selection_range_widget.dart index a4ef0536..b9d28714 100644 --- a/lib/src/components/selection/widget/brn_selection_range_widget.dart +++ b/lib/src/components/selection/widget/brn_selection_range_widget.dart @@ -23,7 +23,8 @@ import 'package:flutter/widgets.dart'; typedef void BrnOnRangeSelectionBgClick(); class BrnRangeSelectionGroupWidget extends StatefulWidget { - static final double screenWidth = window.physicalSize.width / window.devicePixelRatio; + static final double screenWidth = + window.physicalSize.width / window.devicePixelRatio; final BrnSelectionEntity entity; final double maxContentHeight; @@ -46,13 +47,16 @@ class BrnRangeSelectionGroupWidget extends StatefulWidget { this.bgClickFunction, this.onSelectionConfirm, this.marginTop = 0, - required this.themeData}): super(key: key); + required this.themeData}) + : super(key: key); @override - _BrnRangeSelectionGroupWidgetState createState() => _BrnRangeSelectionGroupWidgetState(); + _BrnRangeSelectionGroupWidgetState createState() => + _BrnRangeSelectionGroupWidgetState(); } -class _BrnRangeSelectionGroupWidgetState extends State +class _BrnRangeSelectionGroupWidgetState + extends State with SingleTickerProviderStateMixin { List _originalSelectedItemsList = []; List _firstList = []; @@ -77,7 +81,9 @@ class _BrnRangeSelectionGroupWidgetState extends State firstList, Color white) { - if (firstList.isNotEmpty && BrnSelectionUtil.getTotalLevel(widget.entity) == 1) { + Widget _createNewTagAndRangeWidget( + List firstList, Color white) { + if (firstList.isNotEmpty && + BrnSelectionUtil.getTotalLevel(widget.entity) == 1) { return Column( mainAxisSize: MainAxisSize.min, children: [ Flexible( child: SingleChildScrollView( child: Column( - mainAxisSize: MainAxisSize.min, children: _getOneTabContent(widget.entity)), + mainAxisSize: MainAxisSize.min, + children: _getOneTabContent(widget.entity)), ), ), BrnLine( @@ -162,7 +174,8 @@ class _BrnRangeSelectionGroupWidgetState extends State twoCountTagWidth) { tagWidth = oneCountTagWidth; } else if (threeCountTagWidth < maxWidthSize.width && @@ -231,7 +248,9 @@ class _BrnRangeSelectionGroupWidgetState extends State subFilterList = widget.entity.children[_tabController.index].children; - List selectItems = subFilterList.where((f) => f.isSelected).toList(); + List selectItems = + subFilterList.where((f) => f.isSelected).toList(); if (selectItems.length > 0) { _firstList[_tabController.index].isSelected = true; } else { @@ -390,8 +416,9 @@ class _BrnRangeSelectionGroupWidgetState extends State _firstIndex) { - List seconds = widget.entity.children[_firstIndex].children; + List seconds = + widget.entity.children[_firstIndex].children; if (seconds.isNotEmpty) { for (BrnSelectionEntity entity in seconds) { if (entity.isSelected) { @@ -627,7 +659,8 @@ class _BrnRangeSelectionGroupWidgetState extends State 0; + .length > + 0; /// 查找第二层级 if (!hasCalendarItem) { diff --git a/lib/src/components/selection/widget/brn_selection_single_list_widget.dart b/lib/src/components/selection/widget/brn_selection_single_list_widget.dart index 59a2f63c..c7f30183 100644 --- a/lib/src/components/selection/widget/brn_selection_single_list_widget.dart +++ b/lib/src/components/selection/widget/brn_selection_single_list_widget.dart @@ -42,15 +42,18 @@ class BrnSelectionSingleListWidget extends StatefulWidget { .toList(); /// 当前 Items 所在的层级 - currentListIndex = BrnSelectionUtil.getCurrentListIndex(items.length > 0 ? items[0] : null); + currentListIndex = BrnSelectionUtil.getCurrentListIndex( + items.length > 0 ? items[0] : null); _selectedItems = items.where((f) => f.isSelected).toList(); } @override - _BrnSelectionSingleListWidgetState createState() => _BrnSelectionSingleListWidgetState(); + _BrnSelectionSingleListWidgetState createState() => + _BrnSelectionSingleListWidgetState(); } -class _BrnSelectionSingleListWidgetState extends State { +class _BrnSelectionSingleListWidgetState + extends State { @override Widget build(BuildContext context) { return Expanded( @@ -81,13 +84,22 @@ class _BrnSelectionSingleListWidgetState extends State f.isSelected).length ?? 0) > 0) { + (entity.parent?.children + .where((f) => f.isSelected) + .length ?? + 0) > + 0) { /// 点击的是不限类型,且不限类型同级别已经有选中的 item,不检查数量限制。 - } else if((entity.parent?.children.where((f) => f.isSelected && f.isUnLimit()).length ?? 0) > 0){ + } else if ((entity.parent?.children + .where((f) => f.isSelected && f.isUnLimit()) + .length ?? + 0) > + 0) { /// 同级别中,存在不限类型已经选中情况,选择非不限类型 item,不检查数量限制 } else if (entity.isInLastLevel() && !BrnSelectionUtil.checkMaxSelectionCount(entity)) { @@ -102,8 +114,9 @@ class _BrnSelectionSingleListWidgetState extends State 0) { - widget.items[0].parent?.isSelected = - (widget.items[0].parent?.children.where((BrnSelectionEntity f) => f.isSelected).length ?? 0)> 0; + widget.items[0].parent?.isSelected = (widget.items[0].parent?.children + .where((BrnSelectionEntity f) => f.isSelected) + .length ?? + 0) > + 0; } for (BrnSelectionEntity item in widget.items) { @@ -186,10 +202,13 @@ class _BrnSelectionSingleListWidgetState extends State f != selectedEntity).forEach((f) { + selectedEntity.parent?.children + .where((f) => f != selectedEntity) + .forEach((f) { f.clearChildSelection(); f.isSelected = false; }); @@ -197,14 +216,16 @@ class _BrnSelectionSingleListWidgetState extends State f != selectedEntity).forEach((f) { + selectedEntity.parent?.children + .where((f) => f != selectedEntity) + .forEach((f) { f.clearChildSelection(); f.isSelected = false; }); selectedEntity.isSelected = true; } else { ///清除【不限】类型。 - List brotherItems; + List brotherItems; if (selectedEntity.parent == null) { brotherItems = widget.items; } else { diff --git a/lib/src/components/step/brn_horizontal_steps.dart b/lib/src/components/step/brn_horizontal_steps.dart index 911f7325..fd6644ef 100644 --- a/lib/src/components/step/brn_horizontal_steps.dart +++ b/lib/src/components/step/brn_horizontal_steps.dart @@ -5,6 +5,7 @@ import 'package:bruno/src/utils/brn_tools.dart'; import 'package:flutter/material.dart'; const double _kItemSidePadding = 5; + /// 描述: 横向步骤条,是一种常见的导航形式,它具有导航通用的属性:告知用户”我在哪/我能去哪“, /// 步骤数目就相当于告知用户--能去哪或者说流程将要经历什么。 /// 通用组件步骤条分为三个状态:完成态/进行态/等待态,三种状态在样式上均加以区分 @@ -47,7 +48,9 @@ class BrnHorizontalStepsState extends State { } Color _getStepContentTextColor(int index) { - return index > _currentIndex ? const Color(0xFFCCCCCC) : const Color(0xFF222222); + return index > _currentIndex + ? const Color(0xFFCCCCCC) + : const Color(0xFF222222); } void _handleStepStateListenerTick() { @@ -74,8 +77,8 @@ class BrnHorizontalStepsState extends State { @override void didUpdateWidget(covariant BrnHorizontalSteps oldWidget) { super.didUpdateWidget(oldWidget); - final bool isControllerDiff = - oldWidget.controller != null && widget.controller != oldWidget.controller; + final bool isControllerDiff = oldWidget.controller != null && + widget.controller != oldWidget.controller; final bool isCountDiff = widget.steps.length != oldWidget.steps.length; if (isControllerDiff || isCountDiff) { oldWidget.controller?.removeListener(_handleStepStateListenerTick); @@ -120,7 +123,9 @@ class BrnHorizontalStepsState extends State { return Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ - index == 0 ? Expanded(child: SizedBox.shrink()) : _applyLineItem(index, true), + index == 0 + ? Expanded(child: SizedBox.shrink()) + : _applyLineItem(index, true), _applyStepIcon(step, index), index == widget.steps.length - 1 ? Expanded(child: SizedBox.shrink()) @@ -213,7 +218,8 @@ class BrnHorizontalStepsState extends State { return stepContent; } return Container( - margin: const EdgeInsets.only(top: 6, left: _kItemSidePadding, right: _kItemSidePadding), + margin: const EdgeInsets.only( + top: 6, left: _kItemSidePadding, right: _kItemSidePadding), child: Text( step.stepContentText ?? '', maxLines: 1, @@ -239,7 +245,8 @@ class BrnHorizontalStepsState extends State { } /// 使用组件默认的icon - return BrunoTools.getAssetSizeImage(BrnAsset.iconStepCompleted, 20, 20, color: _primary); + return BrunoTools.getAssetSizeImage(BrnAsset.iconStepCompleted, 20, 20, + color: _primary); } Widget _getDoingIcon(BrunoStep step) { @@ -254,7 +261,8 @@ class BrnHorizontalStepsState extends State { return doingIcon; } // 使用组件默认的icon - return BrunoTools.getAssetSizeImage(BrnAsset.iconStepDoing, 20, 20, color: _primary); + return BrunoTools.getAssetSizeImage(BrnAsset.iconStepDoing, 20, 20, + color: _primary); } } diff --git a/lib/src/components/step/brn_step_line.dart b/lib/src/components/step/brn_step_line.dart index 9567d8da..91abb76b 100644 --- a/lib/src/components/step/brn_step_line.dart +++ b/lib/src/components/step/brn_step_line.dart @@ -252,11 +252,11 @@ class _BrnStepLinePainter extends CustomPainter { _BrnStepLinePainter( {required this.lineColor, - this.paintWidth = 1, - required this.iconTopPadding, - required this.isDash, - required this.dashSpace, - required this.dashLength}); + this.paintWidth = 1, + required this.iconTopPadding, + required this.isDash, + required this.dashSpace, + required this.dashLength}); final Paint _paint = Paint() ..strokeCap = StrokeCap.round // 画笔笔触类型 diff --git a/lib/src/components/tabbar/bottom/brn_bottom_tab_bar_item.dart b/lib/src/components/tabbar/bottom/brn_bottom_tab_bar_item.dart index 0e8422a9..c0f6911c 100644 --- a/lib/src/components/tabbar/bottom/brn_bottom_tab_bar_item.dart +++ b/lib/src/components/tabbar/bottom/brn_bottom_tab_bar_item.dart @@ -1,5 +1,3 @@ - - import 'dart:ui' show Color; import 'package:flutter/material.dart'; @@ -16,7 +14,7 @@ class BrnBottomTabBarItem { this.badge, this.badgeNo, this.maxBadgeNo = 99, - }) : activeIcon = activeIcon ?? icon; + }) : activeIcon = activeIcon ?? icon; /// 未选中时的icon final Widget icon; diff --git a/lib/src/components/tabbar/bottom/brn_bottom_tab_bar_main.dart b/lib/src/components/tabbar/bottom/brn_bottom_tab_bar_main.dart index 40cb9016..1dc2f6b4 100644 --- a/lib/src/components/tabbar/bottom/brn_bottom_tab_bar_main.dart +++ b/lib/src/components/tabbar/bottom/brn_bottom_tab_bar_main.dart @@ -1,5 +1,3 @@ - - import 'dart:collection' show Queue; import 'dart:math' as math; @@ -45,8 +43,8 @@ class BrnBottomTabBar extends StatefulWidget { ), assert(0 <= currentIndex && currentIndex < items.length), type = items.length <= 3 - ? BrnBottomTabBarDisplayType.fixed - : BrnBottomTabBarDisplayType.shifting, + ? BrnBottomTabBarDisplayType.fixed + : BrnBottomTabBarDisplayType.shifting, super(key: key); /// 动画是否可见,默认:true @@ -95,7 +93,7 @@ class _BottomNavigationTile extends StatelessWidget { this.isAnimation = true, this.isInkResponse = true, this.badgeColor, - }) ; + }); final BrnBottomTabBarDisplayType type; final BrnBottomTabBarItem item; @@ -236,7 +234,7 @@ class _BottomNavigationTile extends StatelessWidget { ); } - String _getUnReadText(){ + String _getUnReadText() { int _badgeNo = 0; try { if (item.badgeNo != null) { diff --git a/lib/src/components/tabbar/indicator/brn_custom_width_indicator.dart b/lib/src/components/tabbar/indicator/brn_custom_width_indicator.dart index ceb08dbb..316451cf 100644 --- a/lib/src/components/tabbar/indicator/brn_custom_width_indicator.dart +++ b/lib/src/components/tabbar/indicator/brn_custom_width_indicator.dart @@ -1,5 +1,3 @@ - - import 'package:flutter/material.dart'; class CustomWidthUnderlineTabIndicator extends Decoration { diff --git a/lib/src/components/tabbar/indicator/brn_fixed_underline_decoration.dart b/lib/src/components/tabbar/indicator/brn_fixed_underline_decoration.dart index 44a36140..2cae9c14 100644 --- a/lib/src/components/tabbar/indicator/brn_fixed_underline_decoration.dart +++ b/lib/src/components/tabbar/indicator/brn_fixed_underline_decoration.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - - import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; @@ -29,7 +27,7 @@ class BrnFixedUnderlineIndicator extends Decoration { this.width = 1.0, this.thickness = 1.0, this.color = Colors.white, - }) : assert(width >= 1.0); + }) : assert(width >= 1.0); /// The color and weight of the horizontal line drawn below the selected tab. final BorderSide borderSide; diff --git a/lib/src/components/tabbar/indicator/brn_triangle_decoration.dart b/lib/src/components/tabbar/indicator/brn_triangle_decoration.dart index ed6219cf..19b2854f 100644 --- a/lib/src/components/tabbar/indicator/brn_triangle_decoration.dart +++ b/lib/src/components/tabbar/indicator/brn_triangle_decoration.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - - import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; diff --git a/lib/src/components/tabbar/normal/brn_sub_switch_title.dart b/lib/src/components/tabbar/normal/brn_sub_switch_title.dart index 47d43f5c..a1089175 100644 --- a/lib/src/components/tabbar/normal/brn_sub_switch_title.dart +++ b/lib/src/components/tabbar/normal/brn_sub_switch_title.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/src/theme/brn_theme_configurator.dart'; import 'package:flutter/material.dart'; diff --git a/lib/src/components/tabbar/normal/brn_switch_title.dart b/lib/src/components/tabbar/normal/brn_switch_title.dart index 173ee2f2..64c5d175 100644 --- a/lib/src/components/tabbar/normal/brn_switch_title.dart +++ b/lib/src/components/tabbar/normal/brn_switch_title.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/src/components/line/brn_line.dart'; import 'package:bruno/src/components/tabbar/indicator/brn_custom_width_indicator.dart'; import 'package:bruno/src/theme/brn_theme_configurator.dart'; @@ -121,11 +119,8 @@ class _BrnSwitchTitleState extends State } return Container( - padding: EdgeInsets.fromLTRB( - widget.padding.left, - widget.padding.top, - widget.padding.right, - bottomPadding), + padding: EdgeInsets.fromLTRB(widget.padding.left, widget.padding.top, + widget.padding.right, bottomPadding), child: tx, ); }).toList(); diff --git a/lib/src/components/tabbar/normal/brn_tab_bar.dart b/lib/src/components/tabbar/normal/brn_tab_bar.dart index 4405d568..e5fac9a4 100644 --- a/lib/src/components/tabbar/normal/brn_tab_bar.dart +++ b/lib/src/components/tabbar/normal/brn_tab_bar.dart @@ -15,7 +15,9 @@ import 'package:flutter/rendering.dart'; /// [state]:当前组件的State对象,[BrnTabBarState] /// [index]:当前组件的角标 typedef BrnTabBarOnTap = Function(BrnTabBarState state, int index); + const double _tagDefaultSize = 75.0; + /// 带小红点的Tabbar // ignore: must_be_immutable class BrnTabBar extends StatefulWidget { @@ -138,16 +140,16 @@ class BrnTabBar extends StatefulWidget { }) : assert(tabs == null || tabs is List) { this.themeData ??= BrnTabBarConfig(); this.themeData = this.themeData!.merge(BrnTabBarConfig( - backgroundColor: backgroundcolor, - tabHeight: tabHeight, - indicatorHeight: indicatorWeight, - indicatorWidth: indicatorWidth, - labelStyle: BrnTextStyle.withStyle(labelStyle), - unselectedLabelStyle: BrnTextStyle.withStyle(unselectedLabelStyle), - tagSpacing: tagSpacing, - preLineTagCount: preLineTagCount, - tagHeight: tagHeight, - )); + backgroundColor: backgroundcolor, + tabHeight: tabHeight, + indicatorHeight: indicatorWeight, + indicatorWidth: indicatorWidth, + labelStyle: BrnTextStyle.withStyle(labelStyle), + unselectedLabelStyle: BrnTextStyle.withStyle(unselectedLabelStyle), + tagSpacing: tagSpacing, + preLineTagCount: preLineTagCount, + tagHeight: tagHeight, + )); this.themeData = BrnThemeConfigurator.instance .getConfig(configId: this.themeData!.configId) .tabBarConfig @@ -247,14 +249,14 @@ class BrnTabBarState extends State { color: widget.themeData!.backgroundColor, child: widget.showMore ? Row( - children: [ - Container( - width: MediaQuery.of(context).size.width - _moreSpacing, - child: _buildTabBar(), - ), - showMoreWidget(context) - ], - ) + children: [ + Container( + width: MediaQuery.of(context).size.width - _moreSpacing, + child: _buildTabBar(), + ), + showMoreWidget(context) + ], + ) : _buildTabBar(), ); } @@ -330,7 +332,7 @@ class BrnTabBarState extends State { child: !_brnTabbarController.isShow ? BrunoTools.getAssetImage(BrnAsset.iconTriangleDown) : BrunoTools.getAssetImageWithBandColor( - BrnAsset.iconTriangleUp)), + BrnAsset.iconTriangleUp)), ), ); } @@ -398,8 +400,8 @@ class BrnTabBarState extends State { )), Badge( showBadge: (badgeTab.badgeNum != null - ? badgeTab.badgeNum! > 0 - : false) || + ? badgeTab.badgeNum! > 0 + : false) || badgeTab.showRedBadge || (badgeTab.badgeText != null ? badgeTab.badgeText!.isNotEmpty @@ -416,7 +418,7 @@ class BrnTabBarState extends State { alignment: Alignment.topLeft, padding: _badgePadding, position: - BadgePosition.topEnd(top: _paddingTop, end: _paddingRight), + BadgePosition.topEnd(top: _paddingTop, end: _paddingRight), child: Text(badgeTab.text!, maxLines: 1, softWrap: true, @@ -449,47 +451,47 @@ class BrnTabBarState extends State { children: [ Expanded( child: Container( - alignment: Alignment.center, - height: 47, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Visibility( - visible: widget.hasIndex && badgeTab.topText != null, - child: Text( - badgeTab.topText ?? "", - maxLines: 1, - overflow: TextOverflow.ellipsis, - )), - Badge( - showBadge: (badgeTab.badgeNum != null + alignment: Alignment.center, + height: 47, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Visibility( + visible: widget.hasIndex && badgeTab.topText != null, + child: Text( + badgeTab.topText ?? "", + maxLines: 1, + overflow: TextOverflow.ellipsis, + )), + Badge( + showBadge: (badgeTab.badgeNum != null ? badgeTab.badgeNum! > 0 : false) || - badgeTab.showRedBadge || - (badgeTab.badgeText != null - ? badgeTab.badgeText!.isNotEmpty - : false), - badgeContent: Text( - _badgeText, - style: TextStyle( - color: Color(0xFFFFFFFF), fontSize: 10, height: 1), - ), - shape: _badgeShape, - elevation: 0, - toAnimate: false, - borderRadius: _borderRadius, - alignment: Alignment.topLeft, - padding: _badgePadding, - position: BadgePosition.topEnd( - top: _paddingTop, end: _paddingRight), - child: Text(badgeTab.text!, - maxLines: 1, - softWrap: true, - overflow: TextOverflow.ellipsis), - ) - ], - ), - )), + badgeTab.showRedBadge || + (badgeTab.badgeText != null + ? badgeTab.badgeText!.isNotEmpty + : false), + badgeContent: Text( + _badgeText, + style: TextStyle( + color: Color(0xFFFFFFFF), fontSize: 10, height: 1), + ), + shape: _badgeShape, + elevation: 0, + toAnimate: false, + borderRadius: _borderRadius, + alignment: Alignment.topLeft, + padding: _badgePadding, + position: BadgePosition.topEnd( + top: _paddingTop, end: _paddingRight), + child: Text(badgeTab.text!, + maxLines: 1, + softWrap: true, + overflow: TextOverflow.ellipsis), + ) + ], + ), + )), Visibility( visible: widget.hasDivider && !lastElement, child: Container( @@ -553,9 +555,9 @@ class BrnTabBarState extends State { // 展开更多 void showMoreWindow(BuildContext context) { final RenderBox dropDownItemRenderBox = - context.findRenderObject() as RenderBox; + context.findRenderObject() as RenderBox; var position = - dropDownItemRenderBox.localToGlobal(Offset.zero, ancestor: null); + dropDownItemRenderBox.localToGlobal(Offset.zero, ancestor: null); var size = dropDownItemRenderBox.size; _brnTabbarController.top = size.height + position.dy; @@ -629,7 +631,6 @@ class BrnTabBarState extends State { // 更多弹框样式 // ignore: must_be_immutable class _TabBarOverlayWidget extends StatefulWidget { - List? tabs; String? moreWindowText; @@ -726,7 +727,10 @@ class _TabBarOverlayWidgetState extends State<_TabBarOverlayWidget> { Widget _createMoreItems() { // 计算tag的宽度 - _tagWidth = (_parentWidth - widget.spacing * (widget.preLineTagCount - 1) - _padding * 2) / widget.preLineTagCount; + _tagWidth = (_parentWidth - + widget.spacing * (widget.preLineTagCount - 1) - + _padding * 2) / + widget.preLineTagCount; _tagWidth = _tagWidth <= _tagDefaultSize ? _tagDefaultSize : _tagWidth; List widgets = []; List? tabList = widget.tabs; @@ -787,12 +791,12 @@ class _TabBarOverlayWidgetState extends State<_TabBarOverlayWidget> { class BadgeTab { BadgeTab( {this.key, - this.text, - this.badgeNum, - this.topText, - this.badgeText, - this.showRedBadge = false, - this.isAutoDismiss = true}); + this.text, + this.badgeNum, + this.topText, + this.badgeText, + this.showRedBadge = false, + this.isAutoDismiss = true}); final Key? key; diff --git a/lib/src/components/tabbar/normal/brn_tabbar_controller.dart b/lib/src/components/tabbar/normal/brn_tabbar_controller.dart index b0337c54..4e088960 100644 --- a/lib/src/components/tabbar/normal/brn_tabbar_controller.dart +++ b/lib/src/components/tabbar/normal/brn_tabbar_controller.dart @@ -1,5 +1,3 @@ - - import 'dart:async'; import 'package:flutter/material.dart'; diff --git a/lib/src/components/tag/brn_state_tag.dart b/lib/src/components/tag/brn_state_tag.dart index 5b6f806b..83ade3d5 100644 --- a/lib/src/components/tag/brn_state_tag.dart +++ b/lib/src/components/tag/brn_state_tag.dart @@ -20,13 +20,13 @@ class BrnStateTag extends StatelessWidget { final Color? textColor; //默认为等待状态,黄色 - const BrnStateTag( - {Key? key, - required this.tagText, - this.tagState = TagState.waiting, - this.backgroundColor, - this.textColor,}) - : super(key: key); + const BrnStateTag({ + Key? key, + required this.tagText, + this.tagState = TagState.waiting, + this.backgroundColor, + this.textColor, + }) : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/src/components/tag/brn_tag_custom.dart b/lib/src/components/tag/brn_tag_custom.dart index 6a8381db..a3de0e80 100644 --- a/lib/src/components/tag/brn_tag_custom.dart +++ b/lib/src/components/tag/brn_tag_custom.dart @@ -50,7 +50,8 @@ class BrnTagCustom extends StatelessWidget { this.textColor, this.backgroundColor, this.tagBorderRadius = const BorderRadius.all(Radius.circular(2)), - this.textPadding = const EdgeInsets.only(bottom: 0.5, left: 3, right: 3, top: 0), + this.textPadding = + const EdgeInsets.only(bottom: 0.5, left: 3, right: 3, top: 0), this.border, this.fontSize = 11, this.fontWeight = FontWeight.normal, @@ -62,7 +63,8 @@ class BrnTagCustom extends StatelessWidget { Key? key, required this.tagText, this.backgroundColor = Colors.transparent, - this.textPadding = const EdgeInsets.only(bottom: 3, left: 3, right: 3, top: 0), + this.textPadding = + const EdgeInsets.only(bottom: 3, left: 3, right: 3, top: 0), this.fontSize = 11, this.fontWeight = FontWeight.normal, this.tagBorderRadius = const BorderRadius.all(Radius.circular(2)), @@ -71,11 +73,15 @@ class BrnTagCustom extends StatelessWidget { double borderWidth = 1, }) : this.maxWidth = double.infinity, this.border = Border.all( - color: borderColor ?? BrnThemeConfigurator.instance.getConfig().commonConfig.brandPrimary, + color: borderColor ?? + BrnThemeConfigurator.instance + .getConfig() + .commonConfig + .brandPrimary, width: borderWidth, ), - this.textColor = - textColor ?? BrnThemeConfigurator.instance.getConfig().commonConfig.brandPrimary, + this.textColor = textColor ?? + BrnThemeConfigurator.instance.getConfig().commonConfig.brandPrimary, super(key: key); @override @@ -86,7 +92,10 @@ class BrnTagCustom extends StatelessWidget { ), decoration: BoxDecoration( color: backgroundColor ?? - BrnThemeConfigurator.instance.getConfig().commonConfig.brandPrimary, + BrnThemeConfigurator.instance + .getConfig() + .commonConfig + .brandPrimary, shape: BoxShape.rectangle, borderRadius: tagBorderRadius, border: border), @@ -98,7 +107,10 @@ class BrnTagCustom extends StatelessWidget { style: TextStyle( fontSize: fontSize, color: textColor ?? - BrnThemeConfigurator.instance.getConfig().commonConfig.colorTextBaseInverse, + BrnThemeConfigurator.instance + .getConfig() + .commonConfig + .colorTextBaseInverse, fontWeight: fontWeight, ), )); diff --git a/lib/src/components/tag/tagview/brn_delete_tag.dart b/lib/src/components/tag/tagview/brn_delete_tag.dart index 4e22b71e..2fb00e75 100644 --- a/lib/src/components/tag/tagview/brn_delete_tag.dart +++ b/lib/src/components/tag/tagview/brn_delete_tag.dart @@ -89,7 +89,8 @@ class _BrnDeleteTagState extends State { @override void initState() { super.initState(); - _controller = widget.controller ?? BrnDeleteTagController(initTags: widget.tags); + _controller = + widget.controller ?? BrnDeleteTagController(initTags: widget.tags); } @override @@ -128,14 +129,17 @@ class _BrnDeleteTagState extends State { if (widget.softWrap) { result = Wrap( spacing: widget.horizontalSpacing ?? 10, - runSpacing: widget.verticalSpacing != null ? widget.verticalSpacing! - 16 : -6, + runSpacing: + widget.verticalSpacing != null ? widget.verticalSpacing! - 16 : -6, alignment: WrapAlignment.start, children: itemList, ); } else { int tagIdx = 0; var finalTagList = itemList.map((tag) { - double rightPadding = (tagIdx == itemList.length - 1) ? 0 : widget.horizontalSpacing ?? 12; + double rightPadding = (tagIdx == itemList.length - 1) + ? 0 + : widget.horizontalSpacing ?? 12; var padding = Padding( child: tag, padding: EdgeInsets.only(right: rightPadding), @@ -197,15 +201,18 @@ class DeleteTagItemWidget extends StatelessWidget { labelPadding: EdgeInsets.fromLTRB(0, 0, -3, 0), backgroundColor: themeData!.tagBackgroundColor, label: Text(this.title, - overflow: TextOverflow.ellipsis, style: themeData!.tagTextStyle.generateTextStyle()), + overflow: TextOverflow.ellipsis, + style: themeData!.tagTextStyle.generateTextStyle()), shape: shape ?? - RoundedRectangleBorder(borderRadius: BorderRadius.circular(themeData!.tagRadius)), + RoundedRectangleBorder( + borderRadius: BorderRadius.circular(themeData!.tagRadius)), //删除图标 deleteIcon: deleteIconSize != null ? BrunoTools.getAssetSizeImage( BrnAsset.iconClose, deleteIconSize!.width, deleteIconSize!.height, color: deleteIconColor) - : BrunoTools.getAssetImageWithColor(BrnAsset.iconClose, deleteIconColor), + : BrunoTools.getAssetImageWithColor( + BrnAsset.iconClose, deleteIconColor), onDeleted: () { debugPrint('$index'); didDeleted(index); diff --git a/lib/src/components/tag/tagview/brn_select_tag.dart b/lib/src/components/tag/tagview/brn_select_tag.dart index 62f01fe4..f2aed619 100644 --- a/lib/src/components/tag/tagview/brn_select_tag.dart +++ b/lib/src/components/tag/tagview/brn_select_tag.dart @@ -107,7 +107,9 @@ class _BrnSelectTagState extends State { super.initState(); _tagState = widget.tags.map((name) => false).toList(); if (widget.initTagState != null) { - for (int index = 0; index < min(widget.initTagState!.length, widget.tags.length); index++) { + for (int index = 0; + index < min(widget.initTagState!.length, widget.tags.length); + index++) { _tagState[index] = widget.initTagState![index]; } } @@ -221,13 +223,16 @@ class _BrnSelectTagState extends State { void didUpdateWidget(BrnSelectTag oldWidget) { super.didUpdateWidget(oldWidget); // 如果两个数组不相等,重置选中状态 - if (!sameList(oldWidget.tags, widget.tags)) _tagState = List.filled(widget.tags.length, false); + if (!sameList(oldWidget.tags, widget.tags)) + _tagState = List.filled(widget.tags.length, false); } /// 比较两个数组内容是否一致,如果一致,返回 true,否则 false bool sameList(List first, List second) { if (first.length != second.length) return false; int index = 0; - return first.firstWhere((item) => item != second[index++], orElse: () => '') == ''; + return first.firstWhere((item) => item != second[index++], + orElse: () => '') == + ''; } } diff --git a/lib/src/components/toast/brn_toast.dart b/lib/src/components/toast/brn_toast.dart index 41d4e9eb..78b5468f 100644 --- a/lib/src/components/toast/brn_toast.dart +++ b/lib/src/components/toast/brn_toast.dart @@ -76,8 +76,7 @@ class BrnToast { /// 自动根据内容长度决定显示时长,更加人性化 final int autoDuration = min(text.length * 0.06 + 0.8, 5.0).ceil(); - final Duration finalDuration = - duration ?? Duration(seconds: autoDuration); + final Duration finalDuration = duration ?? Duration(seconds: autoDuration); final OverlayEntry overlayEntry = OverlayEntry( builder: (context) { return _ToastWidget( diff --git a/lib/src/constants/brn_asset_constants.dart b/lib/src/constants/brn_asset_constants.dart index abb01801..63f6f41b 100644 --- a/lib/src/constants/brn_asset_constants.dart +++ b/lib/src/constants/brn_asset_constants.dart @@ -28,8 +28,7 @@ class BrnAsset { static const String iconArrowDownUnSelect = "images/icon_arrow_down_unselected.png"; static const String iconArrowRight = "icons/icon_right_arrow_1.png"; - static const String selectCheckedStatus = - "images/select_checked_status.png"; + static const String selectCheckedStatus = "images/select_checked_status.png"; static const String selectNormalStatus = "icons/normol_border.png"; static const String iconSelectedUpTriangle = "icons/icon_selcted_triangle.png"; @@ -72,15 +71,13 @@ class BrnAsset { static const String iconPickerClose = 'images/icon_guanbi.png'; static const String iconNotice = 'icons/icon_notice.png'; - static const String iconNoticeArrowBlue = - 'icons/icon_notice_arrow_blue.png'; + static const String iconNoticeArrowBlue = 'icons/icon_notice_arrow_blue.png'; static const String iconNoticeArrowGreen = 'icons/icon_notice_arrow_green.png'; static const String iconNoticeArrowOrange = 'icons/icon_notice_arrow_orange.png'; static const String iconNoticeArrowRed = 'icons/icon_notice_arrow_red.png'; - static const String iconNoticeCloseBlue = - 'icons/icon_notice_close_blue.png'; + static const String iconNoticeCloseBlue = 'icons/icon_notice_close_blue.png'; static const String iconNoticeCloseGreen = 'icons/icon_notice_close_green.png'; static const String iconNoticeCloseOrange = @@ -107,8 +104,7 @@ class BrnAsset { static const String iconsAvatarNew = '/assets/icons/img_avatar_new.png'; static const String iconAudioPlayer = 'icons/icon_audioplayer_play.png'; - static const String iconAudioPlayerPause = - 'icons/icon_audioplayer_pause.png'; + static const String iconAudioPlayerPause = 'icons/icon_audioplayer_pause.png'; static const String iconGreyPlaceHolder = 'icons/grey_place_holder.png'; diff --git a/lib/src/constants/brn_constants.dart b/lib/src/constants/brn_constants.dart index f08bee66..3bb520ac 100644 --- a/lib/src/constants/brn_constants.dart +++ b/lib/src/constants/brn_constants.dart @@ -85,4 +85,4 @@ class BrnButtonConstant { /// 默认垂直间距 static const double verticalPadding = 8; -} \ No newline at end of file +} diff --git a/lib/src/theme/base/brn_base_config.dart b/lib/src/theme/base/brn_base_config.dart index ccb9ad60..f1829984 100644 --- a/lib/src/theme/base/brn_base_config.dart +++ b/lib/src/theme/base/brn_base_config.dart @@ -46,7 +46,5 @@ abstract class BrnBaseConfig { BrnCommonConfig get commonConfig => _currentLevelCommonConfig ?? - BrnThemeConfigurator.instance - .getConfig(configId: configId) - .commonConfig; + BrnThemeConfigurator.instance.getConfig(configId: configId).commonConfig; } diff --git a/lib/src/theme/base/brn_default_config_utils.dart b/lib/src/theme/base/brn_default_config_utils.dart index 26b02abf..fd63dc05 100644 --- a/lib/src/theme/base/brn_default_config_utils.dart +++ b/lib/src/theme/base/brn_default_config_utils.dart @@ -48,9 +48,6 @@ class BrnDefaultConfigUtils { galleryDetailConfig: defaultGalleryDetailConfig, ); - - - /// 全局默认配置 static BrnCommonConfig defaultCommonConfig = BrnCommonConfig( /// 主题色相关 @@ -224,8 +221,8 @@ class BrnDefaultConfigUtils { ), formPadding: EdgeInsets.only( left: 0.0, - top: defaultCommonConfig.vSpacingLg , - right: defaultCommonConfig.hSpacingLg , + top: defaultCommonConfig.vSpacingLg, + right: defaultCommonConfig.hSpacingLg, bottom: defaultCommonConfig.vSpacingLg, ), titlePaddingSm: EdgeInsets.only(left: 10), @@ -399,7 +396,6 @@ class BrnDefaultConfigUtils { tagMinWidth: 75.0, ); - /// 导航栏配置 static BrnAppBarConfig defaultAppBarConfig = BrnAppBarConfig( backgroundColor: Colors.white, diff --git a/lib/src/theme/brn_initializer.dart b/lib/src/theme/brn_initializer.dart index b90c0b5b..c79f01b7 100644 --- a/lib/src/theme/brn_initializer.dart +++ b/lib/src/theme/brn_initializer.dart @@ -8,7 +8,6 @@ class BrnInitializer { BrnAllThemeConfig? allThemeConfig, String configId = GLOBAL_CONFIG_ID, }) { - /// 配置主题定制 BrnThemeConfigurator.instance.register(allThemeConfig, configId: configId); } diff --git a/lib/src/theme/brn_theme_configurator.dart b/lib/src/theme/brn_theme_configurator.dart index 2449d465..3954cd54 100644 --- a/lib/src/theme/brn_theme_configurator.dart +++ b/lib/src/theme/brn_theme_configurator.dart @@ -5,8 +5,7 @@ const String BRUNO_CONFIG_ID = 'BRUNO_CONFIG_ID'; const String GLOBAL_CONFIG_ID = 'GLOBAL_CONFIG_ID'; class BrnThemeConfigurator { - - BrnThemeConfigurator._(){ + BrnThemeConfigurator._() { _checkAndInitBrunoConfig(); } @@ -26,8 +25,7 @@ class BrnThemeConfigurator { // 打平内部字段 if (allThemeConfig != null) { // 赋值传入配置 - globalConfig[configId] = allThemeConfig - ..initThemeConfig(configId); + globalConfig[configId] = allThemeConfig..initThemeConfig(configId); } } @@ -36,7 +34,6 @@ class BrnThemeConfigurator { /// 2、若获取的为 null,则使用默认的全局配置。 /// 3、若没有配置 GLOBAL_CONFIG_ID ,则使用 BRUNO 的配置。 BrnAllThemeConfig getConfig({String configId = GLOBAL_CONFIG_ID}) { - BrnAllThemeConfig? allThemeConfig = globalConfig[configId] ?? globalConfig[GLOBAL_CONFIG_ID] ?? globalConfig[BRUNO_CONFIG_ID]; diff --git a/lib/src/theme/configs/brn_action_sheet_config.dart b/lib/src/theme/configs/brn_action_sheet_config.dart index b383cf94..2fcb685c 100644 --- a/lib/src/theme/configs/brn_action_sheet_config.dart +++ b/lib/src/theme/configs/brn_action_sheet_config.dart @@ -263,7 +263,8 @@ class BrnActionSheetConfig extends BrnBaseConfig { titleStyle: titleStyle.merge(other._titleStyle), itemTitleStyle: itemTitleStyle.merge(other._itemTitleStyle), itemTitleStyleLink: itemTitleStyleLink.merge(other._itemTitleStyleLink), - itemTitleStyleAlert: itemTitleStyleAlert.merge(other._itemTitleStyleAlert), + itemTitleStyleAlert: + itemTitleStyleAlert.merge(other._itemTitleStyleAlert), itemDescStyle: itemDescStyle.merge(other._itemDescStyle), itemDescStyleLink: itemDescStyleLink.merge(other._itemDescStyleLink), itemDescStyleAlert: itemDescStyleAlert.merge(other._itemDescStyleAlert), diff --git a/lib/src/theme/configs/brn_appbar_config.dart b/lib/src/theme/configs/brn_appbar_config.dart index bc2323b4..5249b3cb 100644 --- a/lib/src/theme/configs/brn_appbar_config.dart +++ b/lib/src/theme/configs/brn_appbar_config.dart @@ -58,12 +58,12 @@ class BrnAppBarConfig extends BrnBaseConfig { super(configId: configId) { _backgroundColor = Color(0xff2E313B); _leadIconBuilder = () => Image.asset( - BrnAsset.iconBackWhite, - package: BrnStrings.flutterPackageName, - width: BrnAppBarTheme.iconSize, - height: BrnAppBarTheme.iconSize, - fit: BoxFit.fitHeight, - ); + BrnAsset.iconBackWhite, + package: BrnStrings.flutterPackageName, + width: BrnAppBarTheme.iconSize, + height: BrnAppBarTheme.iconSize, + fit: BoxFit.fitHeight, + ); _titleStyle = BrnTextStyle( fontSize: BrnAppBarTheme.titleFontSize, fontWeight: FontWeight.w600, @@ -94,12 +94,12 @@ class BrnAppBarConfig extends BrnBaseConfig { super(configId: configId) { _backgroundColor = Colors.white; _leadIconBuilder = () => Image.asset( - BrnAsset.iconBackBlack, - package: BrnStrings.flutterPackageName, - width: BrnAppBarTheme.iconSize, - height: BrnAppBarTheme.iconSize, - fit: BoxFit.fitHeight, - ); + BrnAsset.iconBackBlack, + package: BrnStrings.flutterPackageName, + width: BrnAppBarTheme.iconSize, + height: BrnAppBarTheme.iconSize, + fit: BoxFit.fitHeight, + ); _titleStyle = BrnTextStyle( fontSize: BrnAppBarTheme.titleFontSize, fontWeight: FontWeight.w600, @@ -118,7 +118,7 @@ class BrnAppBarConfig extends BrnBaseConfig { Color get backgroundColor => _backgroundColor ?? - BrnDefaultConfigUtils.defaultAppBarConfig.backgroundColor; + BrnDefaultConfigUtils.defaultAppBarConfig.backgroundColor; /// AppBar 的高度 double? _appBarHeight; @@ -131,7 +131,7 @@ class BrnAppBarConfig extends BrnBaseConfig { BrnWidgetBuilder get leadIconBuilder => _leadIconBuilder ?? - BrnDefaultConfigUtils.defaultAppBarConfig.leadIconBuilder; + BrnDefaultConfigUtils.defaultAppBarConfig.leadIconBuilder; /// 标题样式,仅当直接 title 设置为 String 生效 /// @@ -160,14 +160,14 @@ class BrnAppBarConfig extends BrnBaseConfig { int get titleMaxLength => _titleMaxLength ?? - BrnDefaultConfigUtils.defaultAppBarConfig.titleMaxLength; + BrnDefaultConfigUtils.defaultAppBarConfig.titleMaxLength; /// 左右边距 double? _leftAndRightPadding; double get leftAndRightPadding => _leftAndRightPadding ?? - BrnDefaultConfigUtils.defaultAppBarConfig.leftAndRightPadding; + BrnDefaultConfigUtils.defaultAppBarConfig.leftAndRightPadding; /// 元素间间距 double? _itemSpacing; @@ -194,13 +194,13 @@ class BrnAppBarConfig extends BrnBaseConfig { SystemUiOverlayStyle get systemUiOverlayStyle => _systemUiOverlayStyle ?? - BrnDefaultConfigUtils.defaultAppBarConfig.systemUiOverlayStyle; + BrnDefaultConfigUtils.defaultAppBarConfig.systemUiOverlayStyle; @override void initThemeConfig( - String configId, { - BrnCommonConfig? currentLevelCommonConfig, - }) { + String configId, { + BrnCommonConfig? currentLevelCommonConfig, + }) { super.initThemeConfig( configId, currentLevelCommonConfig: currentLevelCommonConfig, diff --git a/lib/src/theme/configs/brn_enhance_number_card_config.dart b/lib/src/theme/configs/brn_enhance_number_card_config.dart index 12c261aa..faaae1cf 100644 --- a/lib/src/theme/configs/brn_enhance_number_card_config.dart +++ b/lib/src/theme/configs/brn_enhance_number_card_config.dart @@ -73,7 +73,8 @@ class BrnEnhanceNumberCardConfig extends BrnBaseConfig { BrnTextStyle(color: commonConfig.colorTextBase).merge(_titleTextStyle), ); _descTextStyle = userConfig.descTextStyle.merge( - BrnTextStyle(color: commonConfig.colorTextSecondary).merge(_descTextStyle), + BrnTextStyle(color: commonConfig.colorTextSecondary) + .merge(_descTextStyle), ); } diff --git a/lib/src/theme/configs/brn_selection_config.dart b/lib/src/theme/configs/brn_selection_config.dart index 1dc0019b..cec3c9e8 100644 --- a/lib/src/theme/configs/brn_selection_config.dart +++ b/lib/src/theme/configs/brn_selection_config.dart @@ -372,8 +372,7 @@ class BrnSelectionConfig extends BrnBaseConfig { _middleNormalBgColor ??= selectionConfig._middleNormalBgColor; _deepSelectBgColor ??= selectionConfig._deepSelectBgColor; _deepNormalBgColor ??= selectionConfig._deepNormalBgColor; - _tagSelectedBackgroundColor ??= - commonConfig.brandPrimary.withOpacity(0.12); + _tagSelectedBackgroundColor ??= commonConfig.brandPrimary.withOpacity(0.12); _tagNormalBackgroundColor ??= commonConfig.fillBody; _tagRadius ??= commonConfig.radiusSm; _flayerBoldTextStyle = selectionConfig.flayerBoldTextStyle.merge( @@ -540,7 +539,8 @@ class BrnSelectionConfig extends BrnBaseConfig { BrnSelectionConfig merge(BrnSelectionConfig other) { return copyWith( - menuNormalTextStyle: menuNormalTextStyle.merge(other._menuNormalTextStyle), + menuNormalTextStyle: + menuNormalTextStyle.merge(other._menuNormalTextStyle), menuSelectedTextStyle: menuSelectedTextStyle.merge(other._menuSelectedTextStyle), tagTextStyle: tagNormalTextStyle.merge(other._tagNormalTextStyle), @@ -550,9 +550,11 @@ class BrnSelectionConfig extends BrnBaseConfig { tagBackgroundColor: other._tagNormalBackgroundColor, tagSelectedBackgroundColor: other._tagSelectedBackgroundColor, hintTextStyle: hintTextStyle.merge(other._hintTextStyle), - rangeTitleTextStyle: rangeTitleTextStyle.merge(other._rangeTitleTextStyle), + rangeTitleTextStyle: + rangeTitleTextStyle.merge(other._rangeTitleTextStyle), inputTextStyle: inputTextStyle.merge(other._inputTextStyle), - itemNormalTextStyle: itemNormalTextStyle.merge(other._itemNormalTextStyle), + itemNormalTextStyle: + itemNormalTextStyle.merge(other._itemNormalTextStyle), itemSelectedTextStyle: itemSelectedTextStyle.merge(other._itemSelectedTextStyle), itemBoldTextStyle: itemBoldTextStyle.merge(other._itemBoldTextStyle), @@ -571,7 +573,8 @@ class BrnSelectionConfig extends BrnBaseConfig { flayerNormalTextStyle.merge(other._flayerNormalTextStyle), flayerSelectedTextStyle: flayerSelectedTextStyle.merge(other._flayerSelectedTextStyle), - flayerBoldTextStyle: flayerBoldTextStyle.merge(other._flayerBoldTextStyle), + flayerBoldTextStyle: + flayerBoldTextStyle.merge(other._flayerBoldTextStyle), ); } } diff --git a/lib/src/utils/brn_event_bus.dart b/lib/src/utils/brn_event_bus.dart index 9d3832a6..bb8330ff 100644 --- a/lib/src/utils/brn_event_bus.dart +++ b/lib/src/utils/brn_event_bus.dart @@ -33,7 +33,7 @@ class EventBus { static EventBus? _instance; factory EventBus._() { - if(_instance == null) { + if (_instance == null) { _instance = EventBus(); } return _instance!; @@ -79,5 +79,4 @@ class EventBus { void destroy() { _streamController.close(); } - } diff --git a/lib/src/utils/i18n/brn_date_picker_i18n.dart b/lib/src/utils/i18n/brn_date_picker_i18n.dart index 0d90a097..e75687ec 100755 --- a/lib/src/utils/i18n/brn_date_picker_i18n.dart +++ b/lib/src/utils/i18n/brn_date_picker_i18n.dart @@ -75,24 +75,24 @@ class DatePickerI18n { /// Get done button text static String getLocaleDone(DateTimePickerLocale locale) { - final _StringsI18n? i18n = datePickerI18n[locale] ?? - datePickerI18n[datetimePickerLocaleDefault]; + final _StringsI18n? i18n = + datePickerI18n[locale] ?? datePickerI18n[datetimePickerLocaleDefault]; return i18n?.getDoneText() ?? datePickerI18n[datetimePickerLocaleDefault]!.getDoneText(); } /// Get cancel button text static String getLocaleCancel(DateTimePickerLocale locale) { - final _StringsI18n? i18n = datePickerI18n[locale] ?? - datePickerI18n[datetimePickerLocaleDefault]; + final _StringsI18n? i18n = + datePickerI18n[locale] ?? datePickerI18n[datetimePickerLocaleDefault]; return i18n?.getCancelText() ?? datePickerI18n[datetimePickerLocaleDefault]!.getCancelText(); } /// Get locale month array static List getLocaleMonths(DateTimePickerLocale locale) { - final _StringsI18n? i18n = datePickerI18n[locale] ?? - datePickerI18n[datetimePickerLocaleDefault]; + final _StringsI18n? i18n = + datePickerI18n[locale] ?? datePickerI18n[datetimePickerLocaleDefault]; final List? months = i18n?.getMonths(); if (months != null && months.isNotEmpty) { return months; @@ -105,8 +105,8 @@ class DatePickerI18n { DateTimePickerLocale locale, [ bool isFull = true, ]) { - final _StringsI18n? i18n = datePickerI18n[locale] ?? - datePickerI18n[datetimePickerLocaleDefault]; + final _StringsI18n? i18n = + datePickerI18n[locale] ?? datePickerI18n[datetimePickerLocaleDefault]; if (isFull) { final List? weeks = i18n?.getWeeksFull(); if (weeks != null && weeks.isNotEmpty) {