diff --git a/assets/flutter.db b/assets/flutter.db index adc85ea..d4a4de4 100644 Binary files a/assets/flutter.db and b/assets/flutter.db differ diff --git a/lib/blocs/github_authentic/bloc.dart b/lib/blocs/github_authentic/bloc.dart deleted file mode 100644 index c65e763..0000000 --- a/lib/blocs/github_authentic/bloc.dart +++ /dev/null @@ -1,73 +0,0 @@ -import 'dart:async'; -import 'package:equatable/equatable.dart'; -import 'package:flutter_unit/app/utils/http/rep_result.dart'; -import 'package:flutter_unit/model/github/github_user.dart'; -import 'package:flutter_unit/repositories/github_authentic_repository.dart'; -import 'package:flutter_unit/repositories/github_user_repository.dart'; -import 'package:meta/meta.dart'; -import 'package:bloc/bloc.dart'; - -part 'event.dart'; - -part 'state.dart'; - -// 验证的bloc 需要一个 UserRepository - -// 在程序开始时会触发 AppStarted 事件 -// 此时bloc会用 UserRepository 查看是否存在token -// 来返回状态AuthSuccess 或 AuthFailure -// AuthFailure之后出现登录界面, AuthSuccess后会到主页 - -// 在登录完成后会触发LoginOver事件 -// 此时bloc会通过userRepository.persistToken对token进行持久化 - -class GithubAuthenticBloc extends Bloc { - final GithubAuthenticRepository authenticationRepository; - final GithubUserRepository userRepository; - - GithubAuthenticBloc( - {@required this.authenticationRepository, - @required this.userRepository}) - : assert(authenticationRepository != null); - - @override - AuthenticState get initialState => AuthInitial(); - - String get token => authenticationRepository.token; - - GithubUser get user { - if (state is AuthSuccess) { - return (state as AuthSuccess).user; - } - return null; - } - - @override - Stream mapEventToState( - GithubAuthEvent event, - ) async* { - if (event is CheckGithubAuth) { - final bool hasToken = await authenticationRepository.hasToken(); -// await LocalDao.dao.initLocalStorage(); - if (hasToken) { - var user = await userRepository.getLocalUser(); - yield AuthSuccess(token: authenticationRepository.token,user: user); - } else { - yield AuthFailure(); - } - } - - if (event is LoginOver) { - yield AuthLoading(); - await authenticationRepository.persistToken(event.result.msg); - yield AuthSuccess(user: event.result.data,token: event.result.msg); - } - - if (event is LoggedOut) { - yield AuthLoading(); - await userRepository.deleteLocalUser(); - await authenticationRepository.deleteToken(); - yield AuthFailure(); - } - } -} diff --git a/lib/blocs/github_authentic/event.dart b/lib/blocs/github_authentic/event.dart deleted file mode 100644 index 15b2705..0000000 --- a/lib/blocs/github_authentic/event.dart +++ /dev/null @@ -1,26 +0,0 @@ - -part of 'bloc.dart'; - -///********************************验证行为******************************** - -abstract class GithubAuthEvent extends Equatable { - const GithubAuthEvent(); - - @override - List get props => []; -} - -class CheckGithubAuth extends GithubAuthEvent {} - -class LoginOver extends GithubAuthEvent { - final RepResult result; - const LoginOver({this.result}); - - @override - List get props => [result]; - - @override - String toString() => 'LoggedIn { token: $result }'; -} - -class LoggedOut extends GithubAuthEvent {} \ No newline at end of file diff --git a/lib/blocs/github_authentic/state.dart b/lib/blocs/github_authentic/state.dart deleted file mode 100644 index 9550c34..0000000 --- a/lib/blocs/github_authentic/state.dart +++ /dev/null @@ -1,25 +0,0 @@ - - -part of 'bloc.dart'; - -///********************************校验状态******************************** -// -abstract class AuthenticState extends Equatable { - const AuthenticState(); - - @override - List get props => []; -} - - -class AuthInitial extends AuthenticState {} - -class AuthSuccess extends AuthenticState { - final String token; - final GithubUser user; - const AuthSuccess({this.token,this.user}); -} - -class AuthFailure extends AuthenticState {} - -class AuthLoading extends AuthenticState {} \ No newline at end of file diff --git a/lib/blocs/github_login/api.dart b/lib/blocs/github_login/api.dart deleted file mode 100644 index f299e68..0000000 --- a/lib/blocs/github_login/api.dart +++ /dev/null @@ -1,19 +0,0 @@ -import 'dart:convert'; - -import 'package:flutter_unit/app/utils/http/http_util.dart'; -import 'package:flutter_unit/repositories/github_user_repository.dart'; - -/// create by 张风捷特烈 on 2020/6/17 -/// contact me by email 1981462002@qq.com -/// 说明: - -main() async { - - var username ="toly1994328"; - var password ="@#1994328zfjtl"; - - var repository = GithubUserRepository(); - var result = await repository.authenticate(username: username, password: password); - - print(result); -} \ No newline at end of file diff --git a/lib/blocs/github_login/bloc.dart b/lib/blocs/github_login/bloc.dart deleted file mode 100644 index d9918bf..0000000 --- a/lib/blocs/github_login/bloc.dart +++ /dev/null @@ -1,51 +0,0 @@ -import 'dart:async'; -import 'dart:convert'; - -import 'package:bloc/bloc.dart'; -import 'package:flutter_unit/repositories/github_user_repository.dart'; -import '../github_authentic/bloc.dart'; - -import 'package:meta/meta.dart'; -import 'package:equatable/equatable.dart'; - -part 'event.dart'; - -part 'state.dart'; - -class LoginBloc extends Bloc { - final GithubAuthenticBloc authenticationBloc; - - LoginBloc({ - @required this.authenticationBloc, - }):assert(authenticationBloc != null); - - @override - LoginState get initialState => LoginInitial(); - - GithubUserRepository get userRepository => authenticationBloc.userRepository; - - @override - Stream mapEventToState( - LoginEvent event, - ) async* { - if (event is EventLogin) { - yield LoginLoading(); - try { - final result = await userRepository.authenticate( - username: event.username, - password: event.password, - ); - if (result.status) { - authenticationBloc.add(LoginOver(result: result)); - // 本地存储用户信息 -// userRepository.setLocalUser(result.user); - }else{ - yield LoginFailure(error: result.msg); - } - yield LoginInitial(); - } catch (error) { - yield LoginFailure(error: error.toString()); - } - } - } -} diff --git a/lib/blocs/github_login/event.dart b/lib/blocs/github_login/event.dart deleted file mode 100644 index 2b7996c..0000000 --- a/lib/blocs/github_login/event.dart +++ /dev/null @@ -1,21 +0,0 @@ -part of 'bloc.dart'; - -abstract class LoginEvent extends Equatable { - const LoginEvent(); -} - -class EventLogin extends LoginEvent { - final String username; - final String password; - - const EventLogin({ - @required this.username, - @required this.password - }); - - @override - List get props => [username, password]; - - @override - String toString() => 'EventLogin { username: $username, password: $password }'; -} diff --git a/lib/blocs/github_login/state.dart b/lib/blocs/github_login/state.dart deleted file mode 100644 index f242b6e..0000000 --- a/lib/blocs/github_login/state.dart +++ /dev/null @@ -1,24 +0,0 @@ -part of 'bloc.dart'; - -abstract class LoginState extends Equatable { - const LoginState(); - - @override - List get props => []; -} - -class LoginInitial extends LoginState {} - -class LoginLoading extends LoginState {} - -class LoginFailure extends LoginState { - final String error; - - const LoginFailure({@required this.error}); - - @override - List get props => [error]; - - @override - String toString() => ' LoginFailure { error: $error }'; -} diff --git a/lib/blocs/issues/event.dart b/lib/blocs/issues/event.dart deleted file mode 100644 index 59dee6b..0000000 --- a/lib/blocs/issues/event.dart +++ /dev/null @@ -1,41 +0,0 @@ -import 'package:equatable/equatable.dart'; -import 'package:flutter/material.dart'; - -/// create by 张风捷特烈 on 2020/6/17 -/// contact me by email 1981462002@qq.com -/// 说明: - -abstract class IssuesEvent extends Equatable {} - -class LoadIssues extends IssuesEvent { - final String username; - final String repository; - final String sort; - - final String direction; - final int page; - final int pageSize; - - final String state; - - final String labels; - - LoadIssues( - {@required this.username, - @required this.repository, - this.sort, - this.direction, - this.page, - this.pageSize, - this.state, - this.labels}); - - @override - List get props => - [username, repository, sort, direction, page, pageSize, state, labels]; - - @override - String toString() { - return 'LoadIssues{username: $username, repository: $repository, sort: $sort, direction: $direction, page: $page, pageSize: $pageSize, state: $state, labels: $labels}'; - } -} diff --git a/lib/blocs/issues/state.dart b/lib/blocs/issues/state.dart deleted file mode 100644 index f11e510..0000000 --- a/lib/blocs/issues/state.dart +++ /dev/null @@ -1,48 +0,0 @@ -import 'package:equatable/equatable.dart'; -import 'package:flutter_unit/model/github/issue.dart'; - -/// create by 张风捷特烈 on 2020/6/17 -/// contact me by email 1981462002@qq.com -/// 说明: - -abstract class IssuesState extends Equatable{ - -} - -class IssuesLoading extends IssuesState{ - @override - List get props =>[]; - - @override - String toString() { - return 'IssuesLoading{}'; - } -} - -class IssuesLoaded extends IssuesState{ - final List issues; - - IssuesLoaded(this.issues); - - @override - List get props => [issues]; - - @override - String toString() { - return 'IssuesLoaded{issues: $issues}'; - } -} - -class IssuesLoadFailure extends IssuesState{ - final String error; - - IssuesLoadFailure(this.error); - - @override - List get props => [error]; - - @override - String toString() { - return 'IssuesLoadFailure{error: $error}'; - } -} \ No newline at end of file diff --git a/lib/repositories/github_authentic_repository.dart b/lib/repositories/github_authentic_repository.dart deleted file mode 100644 index f03a312..0000000 --- a/lib/repositories/github_authentic_repository.dart +++ /dev/null @@ -1,28 +0,0 @@ -import 'dart:async'; - -import 'package:flutter_unit/storage/dao/local_storage.dart'; -import 'package:shared_preferences/shared_preferences.dart'; - -class GithubAuthenticRepository { - String _token; - - String get token => _token; - - //删除token - Future deleteToken() async { - var success = await LocalStorage.remove(LocalStorage.tokenKey); - return success; - } - - //固化token - Future persistToken(String token) async { - var success = await LocalStorage.save(LocalStorage.tokenKey,token); - return success; - } - - //检查是否有token - Future hasToken() async { - var token = await LocalStorage.get(LocalStorage.tokenKey); - return token == null; - } -} diff --git a/lib/repositories/github_user_repository.dart b/lib/repositories/github_user_repository.dart deleted file mode 100644 index 6e212c1..0000000 --- a/lib/repositories/github_user_repository.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'dart:convert'; -import 'package:flutter_unit/app/utils/http/rep_result.dart'; -import 'package:flutter_unit/model/github/github_user.dart'; - - -/// create by 张风捷特烈 on 2020/6/1 -/// contact me by email 1981462002@qq.com -/// 说明: - -class GithubUserRepository { - Future getLocalUser() async { -// return await LocalDao.dao.queryUser(); - } - - Future setLocalUser(GithubUser userBean) async { -// await LocalDao.dao.insert(userBean); - } - - Future authenticate({ - String username, - String password, - }) async { - String type = username + ":" + password; - var bytes = utf8.encode(type); - var base64Str = base64.encode(bytes); - -// var result = await GithubApi.authorizations(base64: base64Str); - -// result.msg = result.data["token"]; - -// return result; - -// // var result = await Api.login(username,password); -// // 通过result获取token和用户信息 -// await Future.delayed(Duration(seconds: 1));//模拟登陆请求耗时 -// if(username=='toly'&& password =='111111'){ -// return LoginResult( -// status: true, -// msg: '你获得的token值', -// user: UserBean(name: 'toly'), -// ); -// }else{ -// return LoginResult( -// status: false, -// msg: '用户名密码错误', -// user: null, -// ); -// } - } - - Future deleteLocalUser() async { -// return await LocalDao.dao.remove(); - } -} diff --git a/lib/storage/app_storage.dart b/lib/storage/app_storage.dart index 3aaa742..972aaaf 100644 --- a/lib/storage/app_storage.dart +++ b/lib/storage/app_storage.dart @@ -1,4 +1,3 @@ - import 'dart:io'; import 'dart:typed_data'; @@ -9,6 +8,7 @@ import 'package:flutter_unit/blocs/global/global_state.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:sqflite/sqflite.dart'; import 'package:path/path.dart' as path; + /// create by 张风捷特烈 on 2020-03-04 /// contact me by email 1981462002@qq.com /// 说明: @@ -50,15 +50,25 @@ class AppStorage { var databasesPath = await getDatabasesPath(); var dbPath = path.join(databasesPath, "flutter.db"); var exists = await databaseExists(dbPath); - if (!exists) { - try { + const isPro = bool.fromEnvironment('dart.vm.product'); //是否release模式 + + if (!isPro) { + if(!exists){ await Directory(path.dirname(dbPath)).create(recursive: true); - print("========= assets ======拷贝完成===="); - } catch (_) {} + } ByteData data = await rootBundle.load(path.join("assets", "flutter.db")); - List bytes = - data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes); + List bytes = data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes); await File(dbPath).writeAsBytes(bytes, flush: true); + print("==== debug ===== assets ======拷贝完成===="); + return await openDatabase(dbPath, readOnly: false); + } + + if (!exists) { + await Directory(path.dirname(dbPath)).create(recursive: true); + ByteData data = await rootBundle.load(path.join("assets", "flutter.db")); + List bytes = data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes); + await File(dbPath).writeAsBytes(bytes, flush: true); + print("==== release ===== assets ======拷贝完成===="); } else { print("========= 数据库 ======已存在===="); } diff --git a/lib/views/widgets/SingleChildRenderObjectWidget/DecoratedBox/node6_flutterLogo.dart b/lib/views/widgets/SingleChildRenderObjectWidget/DecoratedBox/node6_flutterLogo.dart index 573856c..f0799a4 100644 --- a/lib/views/widgets/SingleChildRenderObjectWidget/DecoratedBox/node6_flutterLogo.dart +++ b/lib/views/widgets/SingleChildRenderObjectWidget/DecoratedBox/node6_flutterLogo.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; /// create by 张风捷特烈 on 2020/4/30 /// contact me by email 1981462002@qq.com -/// 说明: +/// 说明: // { // "widgetId": 70, // "name": 'FlutterLogoDecoration装饰', @@ -15,8 +15,9 @@ class FlutterLogoDecorationDemo extends StatelessWidget { Widget build(BuildContext context) { return DecoratedBox( decoration: FlutterLogoDecoration( - darkColor: Colors.orange, - lightColor: Colors.deepPurpleAccent, +// darkColor: Colors.orange, +// lightColor: Colors.deepPurpleAccent, + margin: EdgeInsets.all(8), style: FlutterLogoStyle.stacked), child: SizedBox( width: 100, diff --git a/lib/views/widgets/StatefulWidget/AnimatedCrossFade/node1_base.dart b/lib/views/widgets/StatefulWidget/AnimatedCrossFade/node1_base.dart index 5083040..cc72e64 100644 --- a/lib/views/widgets/StatefulWidget/AnimatedCrossFade/node1_base.dart +++ b/lib/views/widgets/StatefulWidget/AnimatedCrossFade/node1_base.dart @@ -37,7 +37,7 @@ class _CustomAnimatedCrossFadeState extends State { width: 200, height: 150, color: Colors.orange, - child: FlutterLogo(colors: Colors.blue, size: 100,), + child: FlutterLogo(textColor: Colors.blue, size: 100,), ), secondChild: Container( width: 200, @@ -46,7 +46,7 @@ class _CustomAnimatedCrossFadeState extends State { color: Colors.blue, child: FlutterLogo( textColor: Colors.white, - colors: Colors.orange, +// colors: Colors.orange, size: 100, style: FlutterLogoStyle.stacked,), ), diff --git a/lib/views/widgets/StatefulWidget/AnimatedCrossFade/node2_curve.dart b/lib/views/widgets/StatefulWidget/AnimatedCrossFade/node2_curve.dart index 7522f70..e4ac90f 100644 --- a/lib/views/widgets/StatefulWidget/AnimatedCrossFade/node2_curve.dart +++ b/lib/views/widgets/StatefulWidget/AnimatedCrossFade/node2_curve.dart @@ -37,7 +37,7 @@ class _CurveAnimatedCrossFadeState extends State { width: 200, height: 80, color: Colors.orange , - child: FlutterLogo(colors: Colors.blue,size: 50,), + child: FlutterLogo(textColor: Colors.blue,size: 50,), ), secondChild: Container( width: 200, @@ -46,7 +46,8 @@ class _CurveAnimatedCrossFadeState extends State { color: Colors.blue, child: FlutterLogo( textColor: Colors.white, - colors: Colors.orange,size: 100,style: FlutterLogoStyle.stacked,), +// colors: Colors.orange, + size: 100,style: FlutterLogoStyle.stacked,), ), duration: Duration(milliseconds: 1000), crossFadeState: _crossFadeState, diff --git a/lib/views/widgets/StatefulWidget/CupertinoSegmentedControl/node1_base.dart b/lib/views/widgets/StatefulWidget/CupertinoSegmentedControl/node1_base.dart index 49bc1b2..59ef2c9 100644 --- a/lib/views/widgets/StatefulWidget/CupertinoSegmentedControl/node1_base.dart +++ b/lib/views/widgets/StatefulWidget/CupertinoSegmentedControl/node1_base.dart @@ -7,11 +7,11 @@ import 'package:flutter/material.dart'; /// // { // "widgetId": 262, -// "name": '基本使用', +// "name": 'iOS页签基本使用', // "priority": 1, // "subtitle": // "【children】 : 组件Map 【Map】\n" -// "【onValueChanged】 : 最小值 【ValueChanged】\n" +// "【onValueChanged】 : 值改变回调 【ValueChanged】\n" // "【groupValue】 : 选中值 【T】\n" // "【padding】 : 内边距 【EdgeInsetsGeometry】", // } diff --git a/lib/views/widgets/StatefulWidget/CupertinoSlidingSegmentedControl/node1_base.dart b/lib/views/widgets/StatefulWidget/CupertinoSlidingSegmentedControl/node1_base.dart new file mode 100644 index 0000000..24a542b --- /dev/null +++ b/lib/views/widgets/StatefulWidget/CupertinoSlidingSegmentedControl/node1_base.dart @@ -0,0 +1,55 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020/7/22 +/// contact me by email 1981462002@qq.com +/// 说明: 256 CupertinoSlidingSegmentedControl iOS滑动页签 iOS风格的滑动页签,支持点击、滑动切换。可指定页签颜色、背景色、边距等属性。 +// { +// "widgetId": 256, +// "name": 'iOS滑动页签基本使用', +// "priority": 1, +// "subtitle": +// "【children】 : 组件Map 【Map】\n" +// "【onValueChanged】 : 值改变回调 【ValueChanged】\n" +// "【groupValue】 : 选中值 【T】\n" +// "【thumbColor】 : 选中色 【Color】\n" +// "【backgroundColor】 : 背景色 【Color】\n" +// "【padding】 : 内边距 【EdgeInsetsGeometry】", +// } +class CupertinoSlidingSegmentedControlDemo extends StatefulWidget { + @override + _CupertinoSlidingSegmentedControlDemoState createState() => + _CupertinoSlidingSegmentedControlDemoState(); +} + +class _CupertinoSlidingSegmentedControlDemoState + extends State { + var _value = 1; + + @override + Widget build(BuildContext context) { + return Container( + child: CupertinoSlidingSegmentedControl( + groupValue: _value, + onValueChanged: _onValueChanged, + thumbColor: Colors.amberAccent, + backgroundColor: Colors.green.withAlpha(99), + padding: EdgeInsets.all(5), + children: { + 1: Padding( + padding: EdgeInsets.only(left: 20, right: 20), + child: Text("混沌战士"), + ), + 2: Text("青眼白龙"), + 3: Text("黑魔导"), + }, + ), + ); + } + + void _onValueChanged(int value) { + setState(() { + _value=value; + }); + } +} diff --git a/lib/views/widgets/StatefulWidget/MaterialApp/node1_base.dart b/lib/views/widgets/StatefulWidget/MaterialApp/node1_base.dart index cfb7494..796db6a 100644 --- a/lib/views/widgets/StatefulWidget/MaterialApp/node1_base.dart +++ b/lib/views/widgets/StatefulWidget/MaterialApp/node1_base.dart @@ -13,22 +13,117 @@ import '../../StatefulWidget/Scaffold/node1_base.dart'; // "subtitle": // "【theme】 : 主题 【ThemeData】\n" // "【title】 : 任务栏标题 【String】\n" +// "【debugShowCheckedModeBanner】 : 开启角标 【bool】\n" +// "【showPerformanceOverlay】 : 开启性能浮层 【bool】\n" +// "【debugShowMaterialGrid】 : 开启网格 【bool】\n" // "【onGenerateRoute】 : 路由生成器 【RouteFactory】\n" // "【home】 : 主页 【Widget】", // } -class CustomMaterialApp extends StatelessWidget { +class MaterialAppDemo extends StatefulWidget { + @override + _WidgetsAppDemoState createState() => _WidgetsAppDemoState(); +} + +class _WidgetsAppDemoState extends State { + var _debugShowCheckedModeBanner = false; + var _showPerformanceOverlay = false; + var _debugShowMaterialGrid = false; + @override Widget build(BuildContext context) { - return Container( - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.height - 200, - child: MaterialApp( - title: 'Flutter Demo', - onGenerateRoute: Router.generateRoute, - theme: ThemeData( - primarySwatch: Colors.blue, + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + _buildSwitchers(), + Container( + height: 250, + child: MaterialApp( + debugShowCheckedModeBanner: _debugShowCheckedModeBanner, + showPerformanceOverlay: _showPerformanceOverlay, + debugShowMaterialGrid: _debugShowMaterialGrid, + home: HomePage(), + ), ), - home: CustomScaffold(), + ], + ); + } + + Widget _buildSwitchers() { + return DefaultTextStyle( + style: TextStyle(color: Colors.blue), + child: Wrap( + spacing: 10, + children: [ + Column( + children: [ + Switch( + value: _showPerformanceOverlay, + onChanged: (v) { + setState(() { + _showPerformanceOverlay = v; + }); + }, + ), + Text('性能浮层') + ], + ), + Column( + children: [ + Switch( + value: _debugShowCheckedModeBanner, + onChanged: (v) { + setState(() { + _debugShowCheckedModeBanner = v; + }); + }, + ), + Text('开启角标') + ], + ), + Column( + children: [ + Switch( + value: _debugShowMaterialGrid, + onChanged: (v) { + setState(() { + _debugShowMaterialGrid = v; + }); + }, + ), + Text('开启网格') + ], + ) + ], + ), + ); + } +} + +class HomePage extends StatefulWidget { + @override + _HomePageState createState() => _HomePageState(); +} + +class _HomePageState extends State { + var _count = 0; + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Container( + alignment: Alignment(0, 0.7), + child: Text( + '你点击了$_count次', + style: TextStyle(fontSize: 18, color: Colors.blue), + ), + ), + floatingActionButton: FloatingActionButton( + child: Icon(Icons.add), + onPressed: () { + setState(() { + _count++; + }); + }, ), ); } diff --git a/lib/views/widgets/StatefulWidget/Overlay/node1_base.dart b/lib/views/widgets/StatefulWidget/Overlay/node1_base.dart index 5de2b41..556cfe1 100644 --- a/lib/views/widgets/StatefulWidget/Overlay/node1_base.dart +++ b/lib/views/widgets/StatefulWidget/Overlay/node1_base.dart @@ -11,61 +11,6 @@ import 'package:flutter/material.dart'; // " Overlay.of(context).insert插入全局组件", // } - -bool show = false; -Offset offset = Offset(200, 200); - -final double radius = 60; -var entry = OverlayEntry( - builder: (context) => Stack( - children: [ - Positioned( - left: offset.dx, - top: offset.dy, - child: _buildFloating(), - ), - ], - )); - -///绘制悬浮控件 -_buildFloating() => GestureDetector( - onPanDown: (details) { - offset = details.globalPosition - Offset(radius / 2, radius / 2); - entry.markNeedsBuild(); - }, - onPanUpdate: (DragUpdateDetails details) { - offset = offset + details.delta; - entry.markNeedsBuild(); - }, - onLongPress: hideFloating, - child: Material( - color: Colors.transparent, - child: Container( - height: radius, - width: radius, - alignment: Alignment.center, - decoration: BoxDecoration( - shape: BoxShape.circle, - image: DecorationImage( - image: AssetImage('assets/images/icon_head.png')), - ), - ), - )); - -showFloating(BuildContext context) { - if (!show) { - Overlay.of(context).insert(entry); - show = true; - } -} - -hideFloating() { - if (show) { - entry.remove(); - show = false; - } -} - class CustomOverlay extends StatelessWidget { @override Widget build(BuildContext context) { @@ -103,3 +48,57 @@ class CustomOverlay extends StatelessWidget { ); } } + +bool show = false; +Offset offset = Offset(200, 200); + +final double radius = 60; +var entry = OverlayEntry( + builder: (context) => Stack( + children: [ + Positioned( + left: offset.dx, + top: offset.dy, + child: _buildFloating(), + ), + ], + )); + +///绘制悬浮控件 +_buildFloating() => GestureDetector( + onPanDown: (details) { + offset = details.globalPosition - Offset(radius / 2, radius / 2); + entry.markNeedsBuild(); + }, + onPanUpdate: (DragUpdateDetails details) { + offset = offset + details.delta; + entry.markNeedsBuild(); + }, + onLongPress: hideFloating, + child: Material( + color: Colors.transparent, + child: Container( + height: radius, + width: radius, + alignment: Alignment.center, + decoration: BoxDecoration( + shape: BoxShape.circle, + image: DecorationImage( + image: AssetImage('assets/images/icon_head.png')), + ), + ), + )); + +showFloating(BuildContext context) { + if (!show) { + Overlay.of(context).insert(entry); + show = true; + } +} + +hideFloating() { + if (show) { + entry.remove(); + show = false; + } +} diff --git a/lib/views/widgets/StatefulWidget/WidgetInspector/node1_base.dart b/lib/views/widgets/StatefulWidget/WidgetInspector/node1_base.dart new file mode 100644 index 0000000..100a495 --- /dev/null +++ b/lib/views/widgets/StatefulWidget/WidgetInspector/node1_base.dart @@ -0,0 +1,60 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020/8/16 +/// contact me by email 1981462002@qq.com +/// 说明: 234 WidgetInspector 该组件可以让你很方便地查看子组件层级结构,是Flutter Inspector插件的功能之一。 +// { +// "widgetId": 234, +// "name": "WidgetInspector基本使用", +// "priority": 1, +// "subtitle": "【child】 : 子组件 【Widget】\n" +// "【selectButtonBuilder】: *选择按钮构造器 【InspectorSelectButtonBuilder】", +// } +class WidgetInspectorDemo extends StatelessWidget { + + @override + Widget build(BuildContext context) { + return Container( + height: 200, + child: WidgetInspector( + child: HomePage(), + selectButtonBuilder: _selectButtonBuilder, + ), + ); + } + + Widget _selectButtonBuilder(BuildContext context, onPressed) { + onPressed(); + return Container(); + } +} + +class HomePage extends StatefulWidget { + @override + _HomePageState createState() => _HomePageState(); +} + +class _HomePageState extends State { + var _count = 0; + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Container( + alignment: Alignment(0, 0.7), + child: Text( + '你点击了$_count次', + style: TextStyle(fontSize: 18, color: Colors.blue), + ), + ), + floatingActionButton: FloatingActionButton( + child: Icon(Icons.add), + onPressed: () { + setState(() { + _count++; + }); + }, + ), + ); + } +} diff --git a/lib/views/widgets/StatefulWidget/WidgetsApp/node1_base.dart b/lib/views/widgets/StatefulWidget/WidgetsApp/node1_base.dart new file mode 100644 index 0000000..3dee921 --- /dev/null +++ b/lib/views/widgets/StatefulWidget/WidgetsApp/node1_base.dart @@ -0,0 +1,128 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020/8/16 +/// contact me by email 1981462002@qq.com +/// 说明: 236 WidgetsApp 集合一个应用程序需要的部件,如路由、语言、一些调试开关等。也是实现MaterialApp和CupertinoApp的核心组件。 +// { +// "widgetId": 236, +// "name": "WidgetsApp基本使用", +// "priority": 1, +// "subtitle": "【pageRouteBuilder】 : *路由构造器 【PageRouteFactory】\n" +// "【color】: *颜色 【Color】\n" +// "【debugShowWidgetInspector】: 是否显示z组件查看器 【bool】\n" +// "其他属性基本上同MaterialApp,详见之。", +// } +class WidgetsAppDemo extends StatefulWidget { + @override + _WidgetsAppDemoState createState() => _WidgetsAppDemoState(); +} + +class _WidgetsAppDemoState extends State { + var _debugShowCheckedModeBanner = false; + var _debugShowWidgetInspector = false; + var _showPerformanceOverlay = false; + + @override + Widget build(BuildContext context) { + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + _buildSwitchers(), + Container( + height: 250, + child: WidgetsApp( + color: Colors.blue, + debugShowCheckedModeBanner: _debugShowCheckedModeBanner, + showPerformanceOverlay: _showPerformanceOverlay, + debugShowWidgetInspector: _debugShowWidgetInspector, + pageRouteBuilder: + (RouteSettings settings, WidgetBuilder builder) { + return MaterialPageRoute(settings: settings, builder: builder); + }, + home: HomePage(), + ), + ), + ], + ); + } + + Widget _buildSwitchers() { + return DefaultTextStyle( + style: TextStyle(color: Colors.blue), + child: Wrap( + spacing: 10, + children: [ + Column( + children: [ + Switch( + value: _showPerformanceOverlay, + onChanged: (v) { + setState(() { + _showPerformanceOverlay = v; + }); + }, + ), + Text('性能浮层') + ], + ), + Column( + children: [ + Switch( + value: _debugShowCheckedModeBanner, + onChanged: (v) { + setState(() { + _debugShowCheckedModeBanner = v; + }); + }, + ), + Text('开启角标') + ], + ), + Column( + children: [ + Switch( + value: _debugShowWidgetInspector, + onChanged: (v) { + setState(() { + _debugShowWidgetInspector = v; + }); + }, + ), + Text('检查器') + ], + ) + ], + ), + ); + } +} + +class HomePage extends StatefulWidget { + @override + _HomePageState createState() => _HomePageState(); +} + +class _HomePageState extends State { + var _count = 0; + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Container( + alignment: Alignment(0, 0.7), + child: Text( + '你点击了$_count次', + style: TextStyle(fontSize: 18, color: Colors.blue), + ), + ), + floatingActionButton: FloatingActionButton( + child: Icon(Icons.add), + onPressed: () { + setState(() { + _count++; + }); + }, + ), + ); + } +} diff --git a/lib/views/widgets/StatelessWidget/Banner/node1_base.dart b/lib/views/widgets/StatelessWidget/Banner/node1_base.dart index 4b7e3a0..5fff743 100644 --- a/lib/views/widgets/StatelessWidget/Banner/node1_base.dart +++ b/lib/views/widgets/StatelessWidget/Banner/node1_base.dart @@ -38,7 +38,7 @@ class CustomBanner extends StatelessWidget { color: data[e], child: Padding( padding: EdgeInsets.all(20), - child: FlutterLogo(colors: Colors.blue, + child: FlutterLogo(textColor: Colors.blue, style: FlutterLogoStyle.horizontal,)), ), )).toList()); diff --git a/lib/views/widgets/StatelessWidget/FlutterLogo/node1_base.dart b/lib/views/widgets/StatelessWidget/FlutterLogo/node1_base.dart index fae2963..fe426b7 100644 --- a/lib/views/widgets/StatelessWidget/FlutterLogo/node1_base.dart +++ b/lib/views/widgets/StatelessWidget/FlutterLogo/node1_base.dart @@ -26,7 +26,7 @@ class CustomFlutterLogo extends StatelessWidget { children: data.keys .map((e) => FlutterLogo( size: data[e], - colors: e, + textColor: e, )) .toList(), ); diff --git a/lib/views/widgets/StatelessWidget/GestureDetector/node1_base.dart b/lib/views/widgets/StatelessWidget/GestureDetector/node1_base.dart index e9f2dfc..040abfd 100644 --- a/lib/views/widgets/StatelessWidget/GestureDetector/node1_base.dart +++ b/lib/views/widgets/StatelessWidget/GestureDetector/node1_base.dart @@ -15,8 +15,8 @@ import 'package:flutter/material.dart'; // "subtitle": // "【child】 : 子组件 【Widget】\n" // "【onTap】 : 点击事件 【Function()】\n" -// "【onDoubleTap】 : 双击事件 【Function()】\n" -// "【onLongPress】 : 长按事件 【Function()】", +// "【onDoubleTap】 : 双击事件 【GestureTapCallback】\n" +// "【onLongPress】 : 长按事件 【GestureLongPressCallback】", // } class CustomGestureDetector extends StatefulWidget { diff --git a/lib/views/widgets/StatelessWidget/GestureDetector/node2_tap.dart b/lib/views/widgets/StatelessWidget/GestureDetector/node2_tap.dart index b2e6242..2d36002 100644 --- a/lib/views/widgets/StatelessWidget/GestureDetector/node2_tap.dart +++ b/lib/views/widgets/StatelessWidget/GestureDetector/node2_tap.dart @@ -9,9 +9,9 @@ import 'package:flutter/material.dart'; // "name": 'GestureDetector详情信息', // "priority": 2, // "subtitle": -// "【onTapDown】 : 按下回调 【Function(TapDownDetails)】\n" -// "【onTapUp】 : 子组件 【Function(TapUpDetails)】\n" -// "【onTapCancel】 : 点击取消 【Function()】", +// "【onTapDown】 : 按下回调 【GestureTapDownCallback】\n" +// "【onTapUp】 : 点击抬起回调 【GestureTapUpCallback】\n" +// "【onTapCancel】 : 点击取消 【GestureTapCancelCallback】", // } class TapGestureDetector extends StatefulWidget { @override diff --git a/lib/views/widgets/StatelessWidget/GestureDetector/node3_pan.dart b/lib/views/widgets/StatelessWidget/GestureDetector/node3_pan.dart index ab62bfe..d4989fa 100644 --- a/lib/views/widgets/StatelessWidget/GestureDetector/node3_pan.dart +++ b/lib/views/widgets/StatelessWidget/GestureDetector/node3_pan.dart @@ -9,11 +9,11 @@ import 'package:flutter/material.dart'; // "name": 'GestureDetector的Pan事件', // "priority": 3, // "subtitle": -// "【onPanDown】 : 按下回调 【Function(DragDownDetails)】\n" -// "【onPanEnd】 : 拖动结束 【Function(DragEndDetails)】\n" -// "【onPanStart】 : 开始拖动 【Function(DragStartDetails)】\n" -// "【onPanUpdate】 : 拖动更新 【Function(TapUpDetails)】\n" -// "【onPanCancel】 : 拖动取消 【Function()】", +// "【onPanDown】 : 按下回调 【GestureDragDownCallback】\n" +// "【onPanEnd】 : 拖动结束 【GestureDragEndCallback】\n" +// "【onPanStart】 : 开始拖动 【GestureDragStartCallback】\n" +// "【onPanUpdate】 : 拖动更新 【GestureDragUpdateCallback】\n" +// "【onPanCancel】 : 拖动取消 【GestureDragCancelCallback】", // } class PanGestureDetector extends StatefulWidget { @override diff --git a/lib/views/widgets/StatelessWidget/ListView/node1_base.dart b/lib/views/widgets/StatelessWidget/ListView/node1_base.dart index 457db7a..0d417a6 100644 --- a/lib/views/widgets/StatelessWidget/ListView/node1_base.dart +++ b/lib/views/widgets/StatelessWidget/ListView/node1_base.dart @@ -9,7 +9,7 @@ import 'package:flutter/material.dart'; // "priority": 1, // "subtitle": // "【children】 : 子组件列表 【List】\n" -// "【padding】 : 点击事件 【EdgeInsetsGeometry】", +// "【padding】 : 内边距 【EdgeInsetsGeometry】", // } class CustomListView extends StatelessWidget { final data = [ diff --git a/lib/views/widgets/StatelessWidget/NotificationListener/node1_base.dart b/lib/views/widgets/StatelessWidget/NotificationListener/node1_base.dart new file mode 100644 index 0000000..87e932b --- /dev/null +++ b/lib/views/widgets/StatelessWidget/NotificationListener/node1_base.dart @@ -0,0 +1,65 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020/8/14 +/// contact me by email 1981462002@qq.com +/// 说明: NotificationListener 220 0 通知监听器 可指定Notification子泛型T,监听该类型的变化。Flutter内置很多滑动的Notification,当然你也可以自定义Notification进行监听。 +// { +// "widgetId": 220, +// "name": "监听OverscrollIndicatorNotification", +// "priority": 1, +// "subtitle": "该通知之后在滑动到最顶和最底是回调,通过leading属性判断是顶部还是底部。另外通过notification#disallowGlow(),可以去除顶底滑动蓝色阴影", +// } + +class NotificationListenerDemo extends StatefulWidget { + @override + _NotificationListenerDemoState createState() => _NotificationListenerDemoState(); +} + +class _NotificationListenerDemoState extends State { + final data = List.generate(30, (i) => '第${i + 1}条'); + + @override + Widget build(BuildContext context) { + return Container( + height: 250, + child: NotificationListener( + onNotification: _onNotification, + child: CupertinoScrollbar( + child: ListView.separated( + itemBuilder: _buildItem, + itemCount: data.length, + separatorBuilder: (_,__)=>Divider(height: 5,), + ), + )), + ); + } + + bool _onNotification(OverscrollIndicatorNotification notification) { + if (notification.leading) { + notification.disallowGlow(); + Scaffold.of(context).showSnackBar(SnackBar( + content: Text('已滑到顶部'), + backgroundColor: Colors.blue, + duration: Duration(milliseconds: 200), + )); + } else { + notification.disallowGlow(); + Scaffold.of(context).showSnackBar(SnackBar( + content: Text('已滑到底部'), + duration: Duration(milliseconds: 200), + backgroundColor: Colors.blue, + )); + } + + return true; + } + + Widget _buildItem(BuildContext context, int index) { + return Container( + height: 50, + alignment: Alignment.center, + child: Text(data[index],style: TextStyle(color: Theme.of(context).primaryColor,fontSize: 18),), + ); + } +} diff --git a/lib/views/widgets/StatelessWidget/NotificationListener/node2_update.dart b/lib/views/widgets/StatelessWidget/NotificationListener/node2_update.dart new file mode 100644 index 0000000..40e0fa8 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/NotificationListener/node2_update.dart @@ -0,0 +1,87 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020/8/14 +/// contact me by email 1981462002@qq.com +/// 说明: NotificationListener 210 0 通知监听器 可指定Notification子泛型T,监听该类型的变化。Flutter内置很多滑动的Notification,当然你也可以自定义Notification进行监听。 +// { +// "widgetId": 220, +// "name": "监听ScrollUpdateNotification", +// "priority": 2, +// "subtitle": "在滑动过程中对滑动数据进行回调,你可以获取大量数据来进行操作。", +// } + +class NotificationListenerUpdate extends StatefulWidget { + @override + _NotificationListenerUpdateState createState() => + _NotificationListenerUpdateState(); +} + +class _NotificationListenerUpdateState + extends State { + final data = List.generate(30, (i) => '第${i + 1}条'); + + var _info = ''; + + @override + Widget build(BuildContext context) { + return Container( + height: 300, + child: Stack( + children: [ + Positioned(child: Padding( + padding: const EdgeInsets.only(left:8.0), + child: Text(_info), + )), + NotificationListener( + onNotification: _onNotification, + child: CupertinoScrollbar( + child: ListView.separated( + itemBuilder: _buildItem, + itemCount: data.length, + separatorBuilder: (_, __) => Divider( + height: 5, + ), + ), + )), + + ], + ), + ); + } + + bool _onNotification(ScrollUpdateNotification notification) { + + setState(() { + _info = 'axis------【${notification.metrics.axis}】------\n' + 'pixels------【${notification.metrics.pixels}】------\n' + 'atEdge------【${notification.metrics.atEdge}】------\n' + 'axisDirection------【${notification.metrics.axisDirection}】------\n' + 'extentInside------【${notification.metrics.extentInside}】------\n' + 'outOfRange------【${notification.metrics.outOfRange}】------\n' + 'minScrollExtent------【${notification.metrics.minScrollExtent}】------\n' + 'maxScrollExtent------【${notification.metrics.maxScrollExtent}】------\n' + 'viewportDimension------【${notification.metrics.viewportDimension}】------\n' + 'delta------【${notification.dragDetails?.delta}】------\n' + 'globalPosition------【${notification.dragDetails?.globalPosition}】------\n' + 'localPosition------【${notification.dragDetails?.localPosition}】------\n' + 'scrollDelta------【${notification.scrollDelta}】------\n' + 'depth------【${notification.depth}】------'; + + }); + + return true; + } + + Widget _buildItem(BuildContext context, int index) { + return Container( + height: 50, + alignment: Alignment.centerRight, + padding: EdgeInsets.only(right: 8), + child: Text( + data[index], + style: TextStyle(color: Theme.of(context).primaryColor, fontSize: 18), + ), + ); + } +} diff --git a/lib/views/widgets/StatelessWidget/PageStorage/node1_base.dart b/lib/views/widgets/StatelessWidget/PageStorage/node1_base.dart new file mode 100644 index 0000000..09e4931 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/PageStorage/node1_base.dart @@ -0,0 +1,115 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020/8/14 +/// contact me by email 1981462002@qq.com +/// 说明: PageStorage 210 0 页面存储器 可以将页面状态进行存储,在切页时可以保持状态。源码中在ScrollView、PageView、ExpansionTile等皆有应用。 +// { +// "widgetId": 210, +// "name": "PageStorage基本使用", +// "priority": 1, +// "subtitle": "【bucket】 : 存储区 【PageStorageBucket】\n" +// "【child】: 子组件 【Widget】\n" +// "上面切换界面初始化组件时并不会将状态重置。如上CountWidget,子组件需要在初始化时从存储器中读取状态,在改变状态时将状态量写入存储器。另外,如果使用MaterialApp已经内置了PageStorage,不过你也可以创建PageStorage。", +// } + +class PageStorageDemo extends StatefulWidget { + @override + _PageStorageDemoState createState() => _PageStorageDemoState(); +} + +class _PageStorageDemoState extends State { + int _pageIndex = 0; + final PageStorageBucket _bucket = PageStorageBucket(); + + @override + Widget build(BuildContext context) { + return Container( + height: 200, + child: Scaffold( + body: PageStorage( + child: _buildContentByIndex(), + bucket: _bucket, + ), + bottomNavigationBar: BottomNavigationBar( + elevation: 0, + backgroundColor: Colors.blueAccent.withAlpha(55), + currentIndex: _pageIndex, + onTap: (int index) { + setState(() { + _pageIndex = index; + }); + }, + items: [ + BottomNavigationBarItem( + icon: Icon(Icons.home), + title: Text('Home'), + ), + BottomNavigationBarItem( + icon: Icon(Icons.settings), + title: Text('Setting'), + ), + ], + ), + ), + ); + } + + Widget _buildContentByIndex() { + if (_pageIndex == 0) { + return CountWidget(key: PageStorageKey('CountWidget1')); + } + + if (_pageIndex == 1) { + return CountWidget(key: PageStorageKey('CountWidget2')); + } + + return ListView(); + } +} + +class CountWidget extends StatefulWidget { + CountWidget({Key key}) : super(key: key); + + @override + _CountWidgetState createState() => _CountWidgetState(); +} + +class _CountWidgetState extends State { + int _count = 0; + + @override + void initState() { + super.initState(); + _count = PageStorage.of(context)?.readState(context) as int ?? 0; + } + + @override + Widget build(BuildContext context) { + return Container( + alignment: Alignment.center, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text('点击了$_count次'), + MaterialButton( + onPressed: _addCount, + child: Icon( + Icons.add, + color: Colors.white, + ), + color: Colors.green, + shape: CircleBorder( + side: BorderSide(width: 2.0, color: Color(0xFFFFDFDFDF)), + )) + ], + ), + ); + } + + void _addCount() { + setState(() { + _count++; + PageStorage.of(context)?.writeState(context, _count); + }); + } +} diff --git a/lib/views/widgets/StatelessWidget/SingleChildScrollView/node1_base.dart b/lib/views/widgets/StatelessWidget/SingleChildScrollView/node1_base.dart index 501935f..d6bc4fd 100644 --- a/lib/views/widgets/StatelessWidget/SingleChildScrollView/node1_base.dart +++ b/lib/views/widgets/StatelessWidget/SingleChildScrollView/node1_base.dart @@ -10,7 +10,7 @@ import 'package:flutter/material.dart'; // "priority": 1, // "subtitle": // "【child】 : 子组件 【Widget】\n" -// "【padding】 : 点击事件 【EdgeInsetsGeometry】", +// "【padding】 : 内边距 【EdgeInsetsGeometry】", // } class CustomSingleChildScrollView extends StatelessWidget { final data = [ diff --git a/lib/views/widgets/StatelessWidget/Text/node5_textDirection.dart b/lib/views/widgets/StatelessWidget/Text/node5_textDirection.dart index e7c74f2..b461332 100644 --- a/lib/views/widgets/StatelessWidget/Text/node5_textDirection.dart +++ b/lib/views/widgets/StatelessWidget/Text/node5_textDirection.dart @@ -10,7 +10,7 @@ import 'package:flutter/material.dart'; // "priority": 5, // "name": "文字方向与最大行数", // "subtitle": "【maxLines】 : 最大行数 【int】\n" -// "【【textDirection】 : 文字方向 【TextDirection】\n" +// "【textDirection】 : 文字方向 【TextDirection】\n" // "下面依次是:rtl、ltr ", // } class TextDirectionText extends StatelessWidget { diff --git a/lib/views/widgets/StatelessWidget/UserAccountsDrawerHeader/node2_pro.dart b/lib/views/widgets/StatelessWidget/UserAccountsDrawerHeader/node2_pro.dart index 2016c58..43ec71b 100644 --- a/lib/views/widgets/StatelessWidget/UserAccountsDrawerHeader/node2_pro.dart +++ b/lib/views/widgets/StatelessWidget/UserAccountsDrawerHeader/node2_pro.dart @@ -53,7 +53,7 @@ class ProUAGHP extends StatelessWidget { ), ), otherAccountsPictures: [ - FlutterLogo(colors: Colors.green), + FlutterLogo(textColor: Colors.green), ], onDetailsPressed: () { diff --git a/lib/views/widgets/exp/stateful_unit.dart b/lib/views/widgets/exp/stateful_unit.dart index b0ae18e..e96641f 100644 --- a/lib/views/widgets/exp/stateful_unit.dart +++ b/lib/views/widgets/exp/stateful_unit.dart @@ -140,3 +140,6 @@ export '../StatefulWidget/Scaffold/node1_base.dart'; export '../StatefulWidget/TabBarView/node1_base.dart'; export '../StatefulWidget/InputDecorator/node1_base.dart'; export '../StatefulWidget/EditableText/node1_base.dart'; +export '../StatefulWidget/CupertinoSlidingSegmentedControl/node1_base.dart'; +export '../StatefulWidget/WidgetsApp/node1_base.dart' hide HomePage; +export '../StatefulWidget/WidgetInspector/node1_base.dart' hide HomePage; diff --git a/lib/views/widgets/exp/stateless_unit.dart b/lib/views/widgets/exp/stateless_unit.dart index fe813a0..edb9a71 100644 --- a/lib/views/widgets/exp/stateless_unit.dart +++ b/lib/views/widgets/exp/stateless_unit.dart @@ -179,4 +179,8 @@ export '../StatelessWidget/SimpleDialogOption/node1_base.dart'; export '../StatelessWidget/SnackBar/node1_base.dart'; export '../StatelessWidget/SnackBarAction/node1_base.dart'; +export '../StatelessWidget/PageStorage/node1_base.dart'; +export '../StatelessWidget/NotificationListener/node1_base.dart'; +export '../StatelessWidget/NotificationListener/node2_update.dart'; + diff --git a/lib/views/widgets/widgets_map.dart b/lib/views/widgets/widgets_map.dart index f480d85..c6a3f98 100644 --- a/lib/views/widgets/widgets_map.dart +++ b/lib/views/widgets/widgets_map.dart @@ -59,10 +59,32 @@ class WidgetsMap { return [ InputDecoratorDemo(), ]; + case "WidgetInspector": + return [ + WidgetInspectorDemo(), + ]; + case "PageStorage": + return [ + PageStorageDemo(), + ]; case "NotificationListener": + return [ + NotificationListenerDemo(), + NotificationListenerUpdate() + ]; + case "Scrollable": return [ ScrollableDemo(), ]; + case "CupertinoSlidingSegmentedControl": + return [ + CupertinoSlidingSegmentedControlDemo(), + ]; + case "WidgetsApp": + return [ + WidgetsAppDemo(), + ]; + case "EditableText": return [ EditableTextDemo(), @@ -449,7 +471,7 @@ class WidgetsMap { ]; case "MaterialApp": return [ - CustomMaterialApp(), + MaterialAppDemo(), ]; case "ClipOval": return [