From 5872efdbb1f18ef520a936cf82f190a76dee366b Mon Sep 17 00:00:00 2001 From: laiiihz Date: Thu, 17 Dec 2020 14:46:06 +0800 Subject: [PATCH] update ui example --- example/lib/main_extention.dart | 2 +- example/lib/main_home.dart | 55 +++++++++++++++++++++++---------- 2 files changed, 39 insertions(+), 18 deletions(-) diff --git a/example/lib/main_extention.dart b/example/lib/main_extention.dart index 953b8e9..f130ed4 100644 --- a/example/lib/main_extention.dart +++ b/example/lib/main_extention.dart @@ -21,7 +21,7 @@ class _MainExtentionState extends State { onPressed: onPressed, child: Row( children: [ - Expanded(child: icon), + Expanded(child: icon ?? SizedBox()), child, Spacer(), ], diff --git a/example/lib/main_home.dart b/example/lib/main_home.dart index f7362dc..1419ece 100644 --- a/example/lib/main_home.dart +++ b/example/lib/main_home.dart @@ -25,6 +25,23 @@ class MainHome extends StatefulWidget { } class _MainHomeState extends State { + _innerButton({ + VoidCallback onPressed, + String title, + IconData icon, + }) { + return TextButton( + onPressed: onPressed, + child: Row( + children: [ + Expanded(child: Icon(icon) ?? SizedBox()), + Text(title), + Spacer(), + ], + ), + ); + } + @override Widget build(BuildContext context) { return ListView( @@ -32,49 +49,53 @@ class _MainHomeState extends State { children: [ Image.asset('assets/logo.webp', height: 50), SizedBox(height: 16.w), - ASButton.info( - title: '颜色 Style Color', - onPressed: () => Get.to(ExampleStyleColor())), - ASButton.info( - title: '按钮 Button', onPressed: () => Get.to(ExampleButton())), - ASButton.info( + _innerButton( + title: '颜色 Style Color', + onPressed: () => Get.to(ExampleStyleColor()), + icon: Icons.colorize, + ), + _innerButton( + title: '按钮 Button', + onPressed: () => Get.to(ExampleButton()), + ), + _innerButton( title: '框架 Scaffold', onPressed: () => Get.to(ExampleScaffold())), - ASButton.info( + _innerButton( title: '选项卡 Tabbar', onPressed: () => Get.to(ExampleTabBar())), - ASButton.info( + _innerButton( title: '数量选择器NumericButton', onPressed: () => Get.to(ExampleNumericButton())), - ASButton.info( + _innerButton( title: '选择器 Pickers', onPressed: () => Get.to(ExamplePicker())), - ASButton.info( + _innerButton( title: '底部按钮 BottomButton', onPressed: () => Get.to(ExampleBottomButton()), ), - ASButton.info( + _innerButton( title: '标签 TAG', onPressed: () => Get.to(ExampleTag()), ), - ASButton.info( + _innerButton( title: '抽屉 DRAWER', onPressed: () => Get.to(ExampleDrawer()), ), - ASButton.info( + _innerButton( title: '对话框 Dialog', onPressed: () => Get.to(ExampleDialog()), ), - ASButton.info( + _innerButton( title: '列表内容项 ListTile', onPressed: () => Get.to(ExampleListTile()), ), - ASButton.info( + _innerButton( title: '文本框 TextField', onPressed: () => Get.to(ExampleTextFiled()), ), - ASButton.info( + _innerButton( title: '刷新组件 Refresh', onPressed: () => Get.to(ExampleRefresh()), ), - ASButton.info( + _innerButton( title: '选框 Box', onPressed: () => Get.to(ExampleBox()), ),