From 4398886847d58fad27f9614e1a3a6d80d62771d2 Mon Sep 17 00:00:00 2001 From: laiiihz Date: Thu, 5 Nov 2020 11:05:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E8=A3=85=E4=BF=AE=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E4=B8=BB=E4=BD=93=E5=92=8C=E5=8D=A1=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/manage/address.png | Bin 0 -> 736 bytes assets/manage/decoration.png | Bin 0 -> 818 bytes assets/manage/home.png | Bin 0 -> 1325 bytes assets/manage/status.png | Bin 0 -> 1917 bytes .../decoration/decoration_data.dart | 118 ++++++++++++ .../decoration/decoration_model.dart | 121 +++++++++++- lib/mock_models/users/user_info_model.dart | 2 +- lib/style/app_style.dart | 2 + .../business_and_fix/business_fix_card.dart | 19 +- .../decoration_manager_card.dart | 182 ++++++++++++++++++ .../decoration_manager_page.dart | 87 ++++++++- lib/ui/widgets/inner/aku_chip_box.dart | 26 +++ 12 files changed, 531 insertions(+), 26 deletions(-) create mode 100644 assets/manage/address.png create mode 100644 assets/manage/decoration.png create mode 100644 assets/manage/home.png create mode 100644 assets/manage/status.png create mode 100644 lib/mock_models/decoration/decoration_data.dart create mode 100644 lib/ui/sub_pages/decoration_manager/decoration_manager_card.dart create mode 100644 lib/ui/widgets/inner/aku_chip_box.dart diff --git a/assets/manage/address.png b/assets/manage/address.png new file mode 100644 index 0000000000000000000000000000000000000000..b03f0f9aae44c2ad53d4a8f02015278f7f7b860a GIT binary patch literal 736 zcmeAS@N?(olHy`uVBq!ia0vp^0U*r51|<6gKdoh8U|R0!;uum9_xAS2b(aEU*gpK% zYzdW}Bje-aQ&RR>HYRqegC+ligh$FdEN3cjV!yO2S^tVBhH2qq>W0TG7BISP!9j0We}uy7KB z8_rp>_V0cFBRKo*=URD{9gQr1sxvt_!lpE^tP#n0D)S@O#jZj8s(GEOi(C%JR-uBV zwY6`w8+yvm-4&d;o`okwB|#xZPFaERI*SGSHC>mZ+Ja2)xD7lfMMqAnUA6oFryUwy z^Ntk$SyuDE!e-y@sI~iK{%Xxx_VVq~q>sD|TMA|NYd!Z*6I4uidFl7LMi!L^$8M%y ze}61w-J!`RpB$^PtCzK6?>f~UrwLv_dNG5 zx48`8{p+&PGUb`w9w(YtPrhlyeyuaUXX7=tNS4-feXoAo6j;qIOWS8`GnvF#7ioN|)%9^;5@Y%HRUPQWt51u5ZpgbE@^#{>d;0zM zH!U~l#n_#*oZjKFzqG+~Qq1{HZ)U#deExX%-FGDh5;Z($x629GevEw@efvNx zzpK+w6bJBgN|#Xe87FadRB=>S2WJJXNK1v*cQcBp%L6BIQU8J4v=#@Kb`V!lS9KQG z=OnmU>yM?7Bb7eTHr1OP6O#7Z`F`)s{k(6IzJxO2qY_|M8esyUvIGDGpi)2?M*{(< z6i~*|KmaNQlyNi=fJy;n91R4ZQa~9;1M>#7){cp2OSx{5;s=8u_>%U35;qWle^LXG z2n|eo`pt6yEIlAIe-M$E%8g_lKSe|*ViqYx14ls+)Uy`Q%x|r|Peiu?m{JjdDdF~F z0NgY{YwaB(y5PERX1;5Tc^Ws~T06V=KTa^$J7dh%-^Z7(f!5lPh^{5rv@yoaGE1K@ z3{OW<^g6*@Z;UZ#05}%_phI<-84X-GWpE0wxS+>9&RY5+9fskKh@5vQ->)Ied~bVu z`&r!hUaxmNilRrZa}m+(CekVOH88i{_NegBGbBbmm>N;1YQu)ztw|5sFXO-&|F5o*60J=7ind4q60T6(H5y;`C5*oNs4GhEZtcVz>N4dwW z*8*8mI*P2_sN}Z`hrRNB{r;07*qoM6N<$g4b(l?EnA( literal 0 HcmV?d00001 diff --git a/assets/manage/home.png b/assets/manage/home.png new file mode 100644 index 0000000000000000000000000000000000000000..935029136222cb7a978e126b49b55b61363a53a7 GIT binary patch literal 1325 zcmV+|1=9M7P)ZB8@n4nk%M?p}iVs+!!!c9>Z5p*|*i;={1ym_6JEj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R2j%FJ$6$a(*w>T`(OtSz?rm=j+^B^K^+O6uRhH za9#^MUDRu&-fBm=`B;QUNX^wLrh~Oflr@=8#FXjAdXsWuM1uJA4&p_UM$5O^J^AWg zk10>c8|jUx(;ez_XQpbUul#%_1V+-TJ0P>lMg7$BR~z?k)*`*bo9mW`>L@h#pVN$Z zx%DT@!_M9*^}7lO#I(AeP;(C6EqjR5zrS{U4ra`d!p^AeAa2vYy-c%7n^Ee`a!kym zC2a3kE?x4|7Ln=c=~?NXRD_}wQQj_s7B%Rb2#TR6G4Ygc64?chS3QxkT}HS;FxI#n rsMWV(fbI2u4Ggi?!s+89!vCK;pbDix&t?? allModels = [ + DecorationModel( + type: DecorationType.DONE, + statusType: DecorationStatusType.DONE, + userHomeModel: UserHomeModel( + userName: '李慧珍', + plot: '深圳华茂悦峰', + detailAddr: '1幢-1单元-302室', + phone: '18201939840', + decorationStatus: false, + ), + decorationTeamModel: DecorationTeamModel( + name: '深圳莫川装修有限公司', + userName: '李惠政', + phone: '19298540192', + ), + cycleCheck: CycleCheck( + decorationDate: DateTime(2020, 1, 23, 12, 23, 0), + authPerson: FixerModel(name: '林鸿章', phone: '18294859301'), + startDate: DateTime(2020, 1, 23, 20, 23, 0), + checkCycle: 7, + checkDetails: [ + CHECK_TYPE.ELECTRIC, + CHECK_TYPE.WATER, + CHECK_TYPE.WALL, + CHECK_TYPE.DOOR_AND_WINDOWS, + ], + ), + workFinishCheck: WorkFinishCheck( + decorationDate: DateTime(2020, 1, 23, 12, 23, 0), + authPerson: FixerModel(name: '林鸿章', phone: '18294859301'), + startDate: DateTime(2020, 1, 23, 20, 23, 0), + checkDetails: [ + CHECK_TYPE.ELECTRIC, + CHECK_TYPE.WATER, + CHECK_TYPE.WALL, + CHECK_TYPE.DOOR_AND_WINDOWS, + CHECK_TYPE.SECURITY, + ], + ), + checkInfomations: [ + CheckInfomation( + checkDate: DateTime(2020, 3, 20, 12, 00), + info: '正常', + checkType: '完工检查', + details: [ + CheckDetail(type: CHECK_TYPE.ELECTRIC), + CheckDetail(type: CHECK_TYPE.WATER), + CheckDetail(type: CHECK_TYPE.WALL), + CheckDetail(type: CHECK_TYPE.DOOR_AND_WINDOWS), + ], + ), + CheckInfomation( + checkDate: DateTime(2020, 2, 14, 12, 00), + info: '正常', + checkType: '周期检查', + details: [ + CheckDetail(type: CHECK_TYPE.ELECTRIC), + CheckDetail(type: CHECK_TYPE.WATER), + CheckDetail(type: CHECK_TYPE.WALL), + CheckDetail(type: CHECK_TYPE.DOOR_AND_WINDOWS), + ], + ), + CheckInfomation( + checkDate: DateTime(2020, 2, 7, 12, 00), + info: '厨房水路异常', + checkType: '周期检查', + details: [ + CheckDetail(type: CHECK_TYPE.ELECTRIC), + CheckDetail(type: CHECK_TYPE.WATER, status: false), + CheckDetail(type: CHECK_TYPE.WALL), + CheckDetail(type: CHECK_TYPE.DOOR_AND_WINDOWS), + ], + ), + CheckInfomation( + checkDate: DateTime(2020, 1, 30, 12, 00), + info: '正常', + checkType: '周期检查', + details: [ + CheckDetail(type: CHECK_TYPE.ELECTRIC), + CheckDetail(type: CHECK_TYPE.WATER), + CheckDetail(type: CHECK_TYPE.WALL), + CheckDetail(type: CHECK_TYPE.DOOR_AND_WINDOWS), + ], + ), + CheckInfomation( + checkDate: DateTime(2020, 1, 23, 12, 00), + info: '正常', + checkType: '周期检查', + details: [ + CheckDetail(type: CHECK_TYPE.ELECTRIC), + CheckDetail(type: CHECK_TYPE.WATER), + CheckDetail(type: CHECK_TYPE.WALL), + CheckDetail(type: CHECK_TYPE.DOOR_AND_WINDOWS), + ], + ), + ], + ), + ]; + + static List getModels(DecorationType type) { + return allModels.where((element) => element.type == type).toList(); + } + + static List getTypeModels(DecorationStatusType type) { + return allModels.where((element) => element.statusType == type).toList(); + } + + static List get allPropertyModels { + return allModels + .where((element) => element.type != DecorationType.WAIT_HAND_OUT) + .toList(); + } +} diff --git a/lib/mock_models/decoration/decoration_model.dart b/lib/mock_models/decoration/decoration_model.dart index c5d49c1..091bcbc 100644 --- a/lib/mock_models/decoration/decoration_model.dart +++ b/lib/mock_models/decoration/decoration_model.dart @@ -1,14 +1,22 @@ +import 'package:aku_community_manager/mock_models/fix/fixer_model.dart'; +import 'package:flutter/material.dart'; + enum DecorationType { - /// - WAIT_, + ///待指派 + WAIT_HAND_OUT, - ///已指派 + ///已指派&待执行 HAND_OUT, ///已执行 DONE, } +enum DecorationStatusType { + PROGRESS, + DONE, +} + enum CHECK_TYPE { ELECTRIC, WATER, @@ -17,13 +25,47 @@ enum CHECK_TYPE { SECURITY, } +Map checkTypeMap = { + CHECK_TYPE.ELECTRIC: '电路', + CHECK_TYPE.WATER: '水路', + CHECK_TYPE.WALL: '墙面', + CHECK_TYPE.DOOR_AND_WINDOWS: '门窗', + CHECK_TYPE.SECURITY: '安防', +}; + +Map checkTypeStringMap = { + '电路': CHECK_TYPE.ELECTRIC, + '水路': CHECK_TYPE.WATER, + '墙面': CHECK_TYPE.WALL, + '门窗': CHECK_TYPE.DOOR_AND_WINDOWS, + '安防': CHECK_TYPE.SECURITY, +}; + class DecorationModel { - DateTime decorationDate; - DateTime startDate; - String checkCycle; + DecorationType type; + DecorationStatusType statusType; UserHomeModel userHomeModel; DecorationTeamModel decorationTeamModel; - List checkTypes; + CycleCheck cycleCheck; + WorkFinishCheck workFinishCheck; + List checkInfomations; + + String get statusTypeValue { + if (statusType == DecorationStatusType.PROGRESS) + return '装修中'; + else + return '装修完成'; + } + + DecorationModel({ + @required this.type, + @required this.statusType, + @required this.userHomeModel, + @required this.decorationTeamModel, + this.cycleCheck, + this.workFinishCheck, + this.checkInfomations, + }); } ///用户家庭信息 @@ -32,11 +74,13 @@ class UserHomeModel { String detailAddr; String userName; String phone; + bool decorationStatus; UserHomeModel({ this.plot, this.detailAddr, this.userName, this.phone, + this.decorationStatus, }); } @@ -51,3 +95,66 @@ class DecorationTeamModel { this.phone, }); } + +///周期检查 +class CycleCheck { + DateTime decorationDate; + FixerModel authPerson; + DateTime startDate; + + ///check cycle in days + int checkCycle; + List checkDetails; + CycleCheck({ + this.decorationDate, + this.authPerson, + this.startDate, + this.checkCycle, + this.checkDetails, + }); +} + +class WorkFinishCheck { + DateTime decorationDate; + FixerModel authPerson; + DateTime startDate; + List checkDetails; + WorkFinishCheck({ + this.decorationDate, + this.authPerson, + this.startDate, + this.checkDetails, + }); +} + +///周期检查细节 +class CheckInfomation { + DateTime checkDate; + List details; + String info; + String checkType; + CheckInfomation({ + this.checkDate, + this.info, + this.details, + this.checkType, + }); + + ///检查结果 + bool get checkAllResult { + for (var item in details) { + if (!item.status) return false; + } + return true; + } +} + +class CheckDetail { + CHECK_TYPE type; + bool status; + CheckDetail({ + @required this.type, + this.status = true, + }); + String get typeValue => checkTypeMap[type]; +} diff --git a/lib/mock_models/users/user_info_model.dart b/lib/mock_models/users/user_info_model.dart index 236e868..3c81639 100644 --- a/lib/mock_models/users/user_info_model.dart +++ b/lib/mock_models/users/user_info_model.dart @@ -4,7 +4,7 @@ enum USER_ROLE { ///管家角色 MANAGER, - ///修理师傅角色 + ///师傅角色 FIXER, ///保安角色 diff --git a/lib/style/app_style.dart b/lib/style/app_style.dart index 82a8f1a..abf1225 100644 --- a/lib/style/app_style.dart +++ b/lib/style/app_style.dart @@ -2,6 +2,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +export 'package:flutter_screenutil/flutter_screenutil.dart'; + class AppStyle { //颜色,渐变主颜色和次级颜色 static const primaryColor = Color(0xFFFDCF12); diff --git a/lib/ui/sub_pages/business_and_fix/business_fix_card.dart b/lib/ui/sub_pages/business_and_fix/business_fix_card.dart index 3b5f754..e439c83 100644 --- a/lib/ui/sub_pages/business_and_fix/business_fix_card.dart +++ b/lib/ui/sub_pages/business_and_fix/business_fix_card.dart @@ -6,6 +6,7 @@ import 'package:aku_community_manager/tools/widget_tool.dart'; import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_and_fix_detail_page.dart'; import 'package:aku_community_manager/ui/sub_pages/business_and_fix/fix_more_time_page.dart'; import 'package:aku_community_manager/ui/sub_pages/business_and_fix/fix_work_finish_page.dart'; +import 'package:aku_community_manager/ui/widgets/inner/aku_chip_box.dart'; import 'package:aku_ui/common_widgets/aku_material_button.dart'; import 'package:common_utils/common_utils.dart'; import 'package:flutter/material.dart'; @@ -66,23 +67,7 @@ class _BusinessFixCardState extends State { children: [ Row( children: [ - Container( - child: Text( - '报事报修', - style: TextStyle( - color: AppStyle.secondaryColor, - fontSize: 20.sp, - fontWeight: FontWeight.bold, - ), - ), - padding: - EdgeInsets.symmetric(vertical: 6.w, horizontal: 16.w), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(2.w), - border: - Border.all(width: 2.w, color: AppStyle.secondaryColor), - ), - ), + AkuChipBox(title: '报事报修'), AkuBox.w(16), Expanded( child: Text( diff --git a/lib/ui/sub_pages/decoration_manager/decoration_manager_card.dart b/lib/ui/sub_pages/decoration_manager/decoration_manager_card.dart new file mode 100644 index 0000000..08b36db --- /dev/null +++ b/lib/ui/sub_pages/decoration_manager/decoration_manager_card.dart @@ -0,0 +1,182 @@ +import 'package:aku_community_manager/mock_models/decoration/decoration_model.dart'; +import 'package:aku_community_manager/mock_models/users/user_info_model.dart'; +import 'package:aku_community_manager/provider/user_provider.dart'; +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/tools/widget_tool.dart'; +import 'package:aku_community_manager/ui/widgets/inner/aku_chip_box.dart'; +import 'package:aku_ui/common_widgets/aku_material_button.dart'; +import 'package:common_utils/common_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:aku_community_manager/tools/screen_tool.dart'; +import 'package:aku_community_manager/const/resource.dart'; +import 'package:provider/provider.dart'; + +class DecorationManagerCard extends StatefulWidget { + final DecorationModel model; + DecorationManagerCard({Key key, @required this.model}) : super(key: key); + + @override + _DecorationManagerCardState createState() => _DecorationManagerCardState(); +} + +class _DecorationManagerCardState extends State { + USER_ROLE get role => + Provider.of(context, listen: false).userInfoModel.role; + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.only(top: 16.w), + padding: EdgeInsets.all(24.w), + child: Column( + children: [ + Row( + children: [ + AkuChipBox(title: '装修管理'), + AkuBox.w(16), + Text( + DateUtil.formatDate( + widget.model.cycleCheck.decorationDate, + format: 'yyyy-MM-dd HH:mm:ss', + ), + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 22.w, + ), + ), + Spacer(), + Text( + _getTagName(), + style: TextStyle( + color: _getTagColor(), + fontSize: 24.w, + ), + ), + ], + ), + AkuBox.h(24), + _buildTile( + R.ASSETS_MANAGE_HOME_PNG, + '小区名称', + widget.model.userHomeModel.plot, + ), + AkuBox.h(12), + _buildTile( + R.ASSETS_MANAGE_ADDRESS_PNG, + '详细地址', + widget.model.userHomeModel.detailAddr, + ), + AkuBox.h(12), + _buildTile( + R.ASSETS_MANAGE_DECORATION_PNG, + '装修公司', + widget.model.decorationTeamModel.name, + ), + AkuBox.h(12), + _buildTile( + R.ASSETS_MANAGE_STATUS_PNG, + '装修状态', + widget.model.statusTypeValue, + ), + Divider( + height: 48.w, + ), + Align( + alignment: Alignment.centerRight, + child: AkuMaterialButton( + onPressed: () {}, + height: 64.w, + minWidth: 160.w, + color: AppStyle.primaryColor, + child: Text( + '查看详情', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 28.w, + ), + ), + radius: 4.w, + ), + ), + ], + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.w), + ), + ); + } + + _buildTile(String path, String title, String subTitle) { + return Row( + children: [ + Image.asset( + path, + height: 40.w, + width: 40.w, + ), + Text( + title, + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 28.sp, + ), + ), + Spacer(), + Text( + subTitle, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold, + ), + ), + ], + ); + } + + _getTagName() { + Map managerMap = { + DecorationType.WAIT_HAND_OUT: '待指派', + DecorationType.HAND_OUT: '已指派', + DecorationType.DONE: '已执行', + }; + + Map fixerMap = { + DecorationType.HAND_OUT: '待执行', + DecorationType.DONE: '已执行', + }; + + Map defaultMap = { + DecorationStatusType.DONE: '装修完成', + DecorationStatusType.PROGRESS: '装修中', + }; + + switch (role) { + case USER_ROLE.MANAGER: + return managerMap[widget.model.type]; + break; + case USER_ROLE.PROPERTY: + return fixerMap[widget.model.type]; + break; + default: + return defaultMap[widget.model.statusType]; + break; + } + } + + Color _getTagColor() { + if (role == USER_ROLE.MANAGER || role == USER_ROLE.PROPERTY) { + if (widget.model.type == DecorationType.WAIT_HAND_OUT || + widget.model.type == DecorationType.HAND_OUT) { + return Color(0xFFFF4501); + } else + return AppStyle.minorTextColor; + } else { + if (widget.model.statusType == DecorationStatusType.PROGRESS) { + return Color(0xFFFF4501); + } else + return Color(0xFF32B814); + } + } +} diff --git a/lib/ui/sub_pages/decoration_manager/decoration_manager_page.dart b/lib/ui/sub_pages/decoration_manager/decoration_manager_page.dart index 36136d7..9bc4958 100644 --- a/lib/ui/sub_pages/decoration_manager/decoration_manager_page.dart +++ b/lib/ui/sub_pages/decoration_manager/decoration_manager_page.dart @@ -1,5 +1,13 @@ +import 'package:aku_community_manager/mock_models/decoration/decoration_data.dart'; +import 'package:aku_community_manager/mock_models/decoration/decoration_model.dart'; +import 'package:aku_community_manager/mock_models/users/user_info_model.dart'; +import 'package:aku_community_manager/provider/user_provider.dart'; +import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_manager_card.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:aku_community_manager/ui/widgets/inner/aku_tab_bar.dart'; +import 'package:aku_community_manager/tools/screen_tool.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class DecorationManagerPage extends StatefulWidget { DecorationManagerPage({Key key}) : super(key: key); @@ -8,11 +16,88 @@ class DecorationManagerPage extends StatefulWidget { _DecorationManagerPageState createState() => _DecorationManagerPageState(); } -class _DecorationManagerPageState extends State { +class _DecorationManagerPageState extends State + with TickerProviderStateMixin { + TabController _tabController; + USER_ROLE get role => + Provider.of(context, listen: false).userInfoModel.role; + + List get tabs { + switch (role) { + case USER_ROLE.MANAGER: + return ['待指派', '已指派', '已执行', '全部']; + break; + + case USER_ROLE.PROPERTY: + return ['待执行', '已执行', '全部']; + break; + default: + return ['装修中', '装修完成', '全部']; + break; + } + } + + @override + void initState() { + super.initState(); + + _tabController = TabController(length: tabs.length, vsync: this); + } + @override Widget build(BuildContext context) { return AkuScaffold( title: '装修管理', + appBarBottom: PreferredSize( + child: AkuTabBar( + controller: _tabController, + tabs: tabs, + ), + preferredSize: Size.fromHeight(96.w), + ), + body: TabBarView( + controller: _tabController, + children: _getViews(), + ), + ); + } + + List _getViews() { + switch (role) { + case USER_ROLE.MANAGER: + return [ + _getSingleListView( + DecorationData.getModels(DecorationType.WAIT_HAND_OUT)), + _getSingleListView(DecorationData.getModels(DecorationType.HAND_OUT)), + _getSingleListView(DecorationData.getModels(DecorationType.DONE)), + _getSingleListView(DecorationData.allModels), + ]; + break; + case USER_ROLE.PROPERTY: + return [ + _getSingleListView(DecorationData.getModels(DecorationType.HAND_OUT)), + _getSingleListView(DecorationData.getModels(DecorationType.DONE)), + _getSingleListView(DecorationData.allPropertyModels), + ]; + default: + return [ + _getSingleListView( + DecorationData.getTypeModels(DecorationStatusType.PROGRESS)), + _getSingleListView( + DecorationData.getTypeModels(DecorationStatusType.DONE)), + _getSingleListView(DecorationData.allPropertyModels), + ]; + break; + } + } + + _getSingleListView(List models) { + return ListView.builder( + itemBuilder: (context, index) { + return DecorationManagerCard(model: models[index]); + }, + itemCount: models.length, + padding: EdgeInsets.symmetric(horizontal: 32.w), ); } } diff --git a/lib/ui/widgets/inner/aku_chip_box.dart b/lib/ui/widgets/inner/aku_chip_box.dart new file mode 100644 index 0000000..ffe96e7 --- /dev/null +++ b/lib/ui/widgets/inner/aku_chip_box.dart @@ -0,0 +1,26 @@ +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:flutter/material.dart'; + +class AkuChipBox extends StatelessWidget { + final String title; + const AkuChipBox({Key key, @required this.title}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Container( + child: Text( + title, + style: TextStyle( + color: AppStyle.secondaryColor, + fontSize: 20.sp, + fontWeight: FontWeight.bold, + ), + ), + padding: EdgeInsets.symmetric(vertical: 6.w, horizontal: 16.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(2.w), + border: Border.all(width: 2.w, color: AppStyle.secondaryColor), + ), + ); + } +}