diff --git a/assets/flutter.db b/assets/flutter.db index c9131a2..4b63520 100644 Binary files a/assets/flutter.db and b/assets/flutter.db differ 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(),