From f9d679dd1060ff806745b70d6989a146ee187516 Mon Sep 17 00:00:00 2001 From: toly <1981462002@qq.com> Date: Tue, 30 Jun 2020 18:31:39 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E5=BC=80=E5=90=AF=E6=80=A7?= =?UTF-8?q?=E8=83=BD=E6=B5=AE=E5=B1=82=E3=80=81CupertinoSegmentedControl?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/flutter.db | Bin 696320 -> 700416 bytes lib/blocs/global/global_bloc.dart | 3 +++ lib/blocs/global/global_event.dart | 9 +++++++++ lib/blocs/global/global_state.dart | 10 ++++++---- lib/views/app/flutter_app.dart | 2 +- lib/views/pages/setting/setting_page.dart | 18 ++++++++++++++++++ lib/views/widgets/exp/stateful_unit.dart | 2 ++ lib/views/widgets/widgets_map.dart | 14 +++++++++----- 8 files changed, 48 insertions(+), 10 deletions(-) diff --git a/assets/flutter.db b/assets/flutter.db index c9131a2a25ff3199f07043ccb6c8c80d363aec77..4b635205f3e30a393a2bbadd0bc25e6b05b0844a 100644 GIT binary patch delta 4833 zcmd^?i&quby~pP_d*08(I}p$Vh$w;{K%OE#AV^RP1~3{8f^tLzfgV7uMqwuLf#L&B zWQ@^9%|nBUG19PWBF0#g+T3W9dm9&Z^?Ef5ij8Svp0#On_n5Xzz0msybXeg_d3G4-gt`&wy*xZhxI*qJKmAIV zkF!??U+Y{51Rr(X(nIoOK*98i%JK?#0~E8wYrFEk?R?0qOfGI3rAO$YdZ6ymC7sd! zrhTW~(mvJtwM*Is?RVNa?TmIxJFazWN3>4u1?}hBPOV*Q)z)jx+A6IcO;Q@0B;Y;Qu!WYd9!WT?i zyXVa`!u@6{;XX5kaIZO@@aJYc;U04w;chdI@L6*V;VyGD;WOqa!ky+wLdzUM*kMKz z?l8j%pU%7Ua=d03d1yC-3ERvd!tG`N;WpEcaI5J{xW)7#Y&CVl&89}U$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&*8U1A&JJ^ z#J3T+XxI<k diff --git a/lib/blocs/global/global_bloc.dart b/lib/blocs/global/global_bloc.dart index c3e22ed..3468ec9 100644 --- a/lib/blocs/global/global_bloc.dart +++ b/lib/blocs/global/global_bloc.dart @@ -48,6 +48,9 @@ class GlobalBloc extends Bloc { ..setBool(SP.showBackground, event.show); //固化数据 yield state.copyWith(showBackGround: event.show); } + if (event is EventSwitchShowOver) { + yield state.copyWith(showPerformanceOverlay: event.show); + } if (event is EventSwitchCoderTheme) { await sp diff --git a/lib/blocs/global/global_event.dart b/lib/blocs/global/global_event.dart index 48ceda7..198c5c5 100644 --- a/lib/blocs/global/global_event.dart +++ b/lib/blocs/global/global_event.dart @@ -50,6 +50,15 @@ class EventSwitchShowBg extends GlobalEvent { List get props => [show]; } +class EventSwitchShowOver extends GlobalEvent { + final bool show; + + const EventSwitchShowOver(this.show); + + @override + List get props => [show]; +} + class EventChangeItemStyle extends GlobalEvent { final int index; diff --git a/lib/blocs/global/global_state.dart b/lib/blocs/global/global_state.dart index a1c4689..380cf14 100644 --- a/lib/blocs/global/global_state.dart +++ b/lib/blocs/global/global_state.dart @@ -7,6 +7,7 @@ class GlobalState extends Equatable { final bool showBackGround; final int codeStyleIndex; final int itemStyleIndex; + final bool showPerformanceOverlay; const GlobalState({ this.fontFamily = 'ComicNeue', @@ -14,11 +15,12 @@ class GlobalState extends Equatable { this.showBackGround = true, this.codeStyleIndex, this.itemStyleIndex, + this.showPerformanceOverlay=false, }); @override List get props => - [ fontFamily, themeColor, showBackGround, codeStyleIndex,itemStyleIndex]; + [ fontFamily, themeColor, showBackGround, codeStyleIndex,itemStyleIndex,showPerformanceOverlay]; GlobalState copyWith({ double height, @@ -27,6 +29,7 @@ class GlobalState extends Equatable { bool showBackGround, int codeStyleIndex, int itemStyleIndex, + bool showPerformanceOverlay, }) => GlobalState( fontFamily: fontFamily ?? this.fontFamily, @@ -34,12 +37,11 @@ class GlobalState extends Equatable { showBackGround: showBackGround ?? this.showBackGround, codeStyleIndex: codeStyleIndex ?? this.codeStyleIndex, itemStyleIndex: itemStyleIndex ?? this.itemStyleIndex, + showPerformanceOverlay: showPerformanceOverlay ?? this.showPerformanceOverlay, ); @override String toString() { - return 'GlobalState{ fontFamily: $fontFamily, themeColor: $themeColor, showBackGround: $showBackGround, codeStyleIndex: $codeStyleIndex, itemStyleIndex: $itemStyleIndex}'; + return 'GlobalState{fontFamily: $fontFamily, themeColor: $themeColor, showBackGround: $showBackGround, codeStyleIndex: $codeStyleIndex, itemStyleIndex: $itemStyleIndex, showPerformanceOverlay: $showPerformanceOverlay}'; } - - } diff --git a/lib/views/app/flutter_app.dart b/lib/views/app/flutter_app.dart index 520ca8d..e38b18b 100644 --- a/lib/views/app/flutter_app.dart +++ b/lib/views/app/flutter_app.dart @@ -17,7 +17,7 @@ class FlutterApp extends StatelessWidget { categoryBloc: BlocProvider.of(context)), child: MaterialApp( // debugShowMaterialGrid: true, -// showPerformanceOverlay: true, + showPerformanceOverlay: state.showPerformanceOverlay, // showSemanticsDebugger: true, // checkerboardOffscreenLayers:true, // checkerboardRasterCacheImages:true, diff --git a/lib/views/pages/setting/setting_page.dart b/lib/views/pages/setting/setting_page.dart index 483e5f2..63c6436 100644 --- a/lib/views/pages/setting/setting_page.dart +++ b/lib/views/pages/setting/setting_page.dart @@ -59,6 +59,9 @@ class SettingPage extends StatelessWidget { ), Divider(), _buildShowBg(context), + Divider(), + _buildShowOver(context), + Divider(), ListTile( leading: Icon( Icons.info, @@ -88,6 +91,21 @@ class SettingPage extends StatelessWidget { }, )); + Widget _buildShowOver(BuildContext context) => + BlocBuilder( + builder: (_, state) => SwitchListTile( + value: state.showPerformanceOverlay, + secondary: Icon( + TolyIcon.icon_show, + color: Theme.of(context).primaryColor, + ), + title: Text('显示性能浮层'), + onChanged: (show) { + BlocProvider.of(context) + .add(EventSwitchShowOver(show)); + }, + )); + Widget _nextIcon(BuildContext context) => Icon(Icons.chevron_right, color: Theme.of(context).primaryColor); } diff --git a/lib/views/widgets/exp/stateful_unit.dart b/lib/views/widgets/exp/stateful_unit.dart index ab0ab01..b257089 100644 --- a/lib/views/widgets/exp/stateful_unit.dart +++ b/lib/views/widgets/exp/stateful_unit.dart @@ -28,6 +28,8 @@ export '../StatefulWidget/CircularProgressIndicator/node1_base.dart'; export '../StatefulWidget/CupertinoActivityIndicator/node1_base.dart'; export '../StatefulWidget/CupertinoSlider/node1_base.dart'; export '../StatefulWidget/CupertinoSwitch/node1_base.dart'; +export '../StatefulWidget/CupertinoSegmentedControl/node1_base.dart'; +export '../StatefulWidget/CupertinoSegmentedControl/node2_color.dart'; export '../StatefulWidget/Image/node1_base.dart'; export '../StatefulWidget/Image/node2_fit.dart'; diff --git a/lib/views/widgets/widgets_map.dart b/lib/views/widgets/widgets_map.dart index 1cc3df8..5d7059a 100644 --- a/lib/views/widgets/widgets_map.dart +++ b/lib/views/widgets/widgets_map.dart @@ -7,8 +7,6 @@ import 'exp/proxy_unit.dart'; import 'exp/other_unit.dart'; import 'exp/sliver_unit.dart'; - - /// create by 张风捷特烈 on 2020-03-04 /// contact me by email 1981462002@qq.com /// 说明: @@ -25,6 +23,11 @@ class WidgetsMap { ContainerTransform(), ContainerConstraints() ]; + case "CupertinoSegmentedControl": + return [ + CupertinoSegmentedControlDemo(), + CupertinoSegmentedControlColor() + ]; case "Text": return [ CustomText(), @@ -172,7 +175,7 @@ class WidgetsMap { return [ NestedScrollViewDemo(), ]; - case "SliverOverlapAbsorber": + case "SliverOverlapAbsorber": return [ SliverOverlapAbsorberDemo(), ]; @@ -674,7 +677,8 @@ class WidgetsMap { case "LicensePage": return [ CustomLicensePage(), - ]; case "Builder": + ]; + case "Builder": return [ BuilderDemo(), ]; @@ -692,7 +696,7 @@ class WidgetsMap { return [ CustomTab(), ]; - case "PreferredSize": + case "PreferredSize": return [ CustomPreferredSize(), AdapterPreferredSize(),