From d8825beee3b6afd6f03580039a0eb2040ff4c6af Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Sat, 8 May 2021 09:19:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8C=85=E8=A3=B9=E4=BB=A3?= =?UTF-8?q?=E6=94=B6=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/constants/application_objects.dart | 3 +- .../express_package_card.dart | 107 ++++++++++++++++++ .../express_package_page.dart | 19 +++- .../express_package_view.dart | 21 ++++ 4 files changed, 148 insertions(+), 2 deletions(-) create mode 100644 lib/pages/express_packages/express_package_card.dart create mode 100644 lib/pages/express_packages/express_package_view.dart diff --git a/lib/constants/application_objects.dart b/lib/constants/application_objects.dart index baa18f2e..eab4910d 100644 --- a/lib/constants/application_objects.dart +++ b/lib/constants/application_objects.dart @@ -1,5 +1,6 @@ // import 'package:aku_community/widget/bee_scaffold.dart'; +import 'package:aku_community/pages/express_packages/express_package_page.dart'; import 'package:flutter/material.dart'; import 'package:aku_community/const/resource.dart'; @@ -76,7 +77,7 @@ List appObjects = [ AO('借还管理', R.ASSETS_APPLICATIONS_BORROW_PNG, () => SelectBorrowReturnPage()), AO('一键报警', R.ASSETS_APPLICATIONS_POLICE_PNG, () => AlarmPage()), AO('设施预约', R.ASSETS_ICONS_TOOL_FACILITY_PNG, () => FacilityAppointmentPage()), - AO('设施预约', R.ASSETS_IMAGES_PLACEHOLDER_WEBP, () => FacilityAppointmentPage()), + AO('快递包裹', R.ASSETS_IMAGES_PLACEHOLDER_WEBP, () => ExpressPackagePage()), // AO( // '小区教育', // R.ASSETS_IMAGES_PLACEHOLDER_WEBP, diff --git a/lib/pages/express_packages/express_package_card.dart b/lib/pages/express_packages/express_package_card.dart new file mode 100644 index 00000000..e5912f2a --- /dev/null +++ b/lib/pages/express_packages/express_package_card.dart @@ -0,0 +1,107 @@ +import 'package:aku_community/base/base_style.dart'; +import 'package:aku_community/widget/bee_divider.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; +import 'package:aku_community/extensions/widget_list_ext.dart'; +import 'package:aku_community/const/resource.dart'; + +class ExpressPackageCard extends StatefulWidget { + final int index; + ExpressPackageCard({Key? key, required this.index}) : super(key: key); + + @override + _ExpressPackageCardState createState() => _ExpressPackageCardState(); +} + +class _ExpressPackageCardState extends State { + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + padding: EdgeInsets.all(24.w), + decoration: BoxDecoration( + color: Colors.white, borderRadius: BorderRadius.circular(8.w)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + '3号柜7号箱', + style: TextStyle( + fontSize: 32.sp, + fontWeight: FontWeight.bold, + color: ktextPrimary, + ), + ), + Spacer(), + (widget.index == 0 ? '未领取' : '已领取') + .text + .size(30.sp) + .color(ktextPrimary) + .bold + .make(), + ], + ), + 16.w.heightBox, + BeeDivider.horizontal(), + 24.w.heightBox, + ...[ + _rowTile(R.ASSETS_ICONS_APPOINTMENT_ADDRESS_PNG, '包裹单号', + '131891726735'.text.size(24.sp).color(ktextSubColor).make()), + _rowTile(R.ASSETS_ICONS_APPOINTMENT_ADDRESS_PNG, '收件人', + '小蒋'.text.size(24.sp).color(ktextSubColor).make()), + _rowTile(R.ASSETS_ICONS_APPOINTMENT_ADDRESS_PNG, '联系方式', + '131891726735'.text.size(24.sp).color(ktextSubColor).make()), + _rowTile(R.ASSETS_ICONS_APPOINTMENT_ADDRESS_PNG, '配送公司', + '顺丰速递'.text.size(24.sp).color(ktextSubColor).make()), + _rowTile( + R.ASSETS_ICONS_APPOINTMENT_DATE_PNG, + '送达时间', + '2020-04-13 11:21' + .text + .size(24.sp) + .color(ktextSubColor) + .make()), + ].sepWidget(separate: 12.w.heightBox), + 40.w.heightBox, + Row( + children: [ + Spacer(), + MaterialButton( + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(74.w)), + padding: EdgeInsets.symmetric(vertical: 8.w, horizontal: 24.w), + height: 50.w, + color: kPrimaryColor, + elevation: 0, + focusElevation: 0, + hoverElevation: 0, + disabledElevation: 0, + highlightElevation: 0, + onPressed: () {}, + child: '确认领取'.text.size(24.sp).bold.color(ktextPrimary).make(), + ) + ], + ), + ], + ), + ); + } + + Widget _rowTile(String assetPath, String titile, Widget content) { + return Row( + children: [ + Image.asset( + assetPath, + width: 40.w, + height: 40.w, + ), + 12.w.widthBox, + titile.text.size(24.sp).color(ktextSubColor).make(), + Spacer(), + content, + ], + ); + } +} diff --git a/lib/pages/express_packages/express_package_page.dart b/lib/pages/express_packages/express_package_page.dart index e8c928ae..6ed5475f 100644 --- a/lib/pages/express_packages/express_package_page.dart +++ b/lib/pages/express_packages/express_package_page.dart @@ -1,4 +1,6 @@ +import 'package:aku_community/pages/express_packages/express_package_view.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; +import 'package:aku_community/widget/tab_bar/bee_tab_bar.dart'; import 'package:flutter/material.dart'; class ExpressPackagePage extends StatefulWidget { @@ -8,11 +10,26 @@ class ExpressPackagePage extends StatefulWidget { _ExpressPackagePageState createState() => _ExpressPackagePageState(); } -class _ExpressPackagePageState extends State { +class _ExpressPackagePageState extends State + with TickerProviderStateMixin { + List _tabs = ['未领取', '已领取']; + late TabController _tabController; + @override + void initState() { + super.initState(); + _tabController = TabController(length: _tabs.length, vsync: this); + } + @override Widget build(BuildContext context) { return BeeScaffold( title: '快递包裹', + appBarBottom: BeeTabBar(controller: _tabController, tabs: _tabs), + body: TabBarView( + controller: _tabController, + children:List.generate(_tabs.length, (index) => ExpressPackageView(index:index)) ), ); } + + } diff --git a/lib/pages/express_packages/express_package_view.dart b/lib/pages/express_packages/express_package_view.dart new file mode 100644 index 00000000..1f83fe19 --- /dev/null +++ b/lib/pages/express_packages/express_package_view.dart @@ -0,0 +1,21 @@ +import 'package:aku_community/pages/express_packages/express_package_card.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class ExpressPackageView extends StatefulWidget { + final int index; + ExpressPackageView({Key? key, required this.index}) : super(key: key); + + @override + _ExpressPackageViewState createState() => _ExpressPackageViewState(); +} + +class _ExpressPackageViewState extends State { + @override + Widget build(BuildContext context) { + return ListView( + padding: EdgeInsets.symmetric(vertical: 16.w,horizontal: 32.w), + children: [ExpressPackageCard(index: widget.index)], + ); + } +}