update homepage

hmxc
小赖 4 years ago
parent 306e240fb8
commit 10732df11d

@ -0,0 +1,49 @@
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/fix/fix_model.dart';
import 'package:aku_community_manager/provider/fix_provider.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class AllModel {
BuildContext context;
AllModel(this.context);
List get allThings {
final fixProvider = Provider.of<FixProvider>(context, listen: false);
return [
...fixProvider.fixModels,
...DecorationData.allModels,
];
}
List get waitThings {
final fixProvider = Provider.of<FixProvider>(context, listen: false);
return [
...fixProvider.fixModels.where((element) {
return element.type == FIX_ENUM.WAIT_PICKUP;
}).toList(),
...DecorationData.getModels(DecorationType.WAIT_HAND_OUT),
];
}
List get processingThings {
final fixProvider = Provider.of<FixProvider>(context, listen: false);
return [
...fixProvider.fixModels.where((element) {
return element.type == FIX_ENUM.PROCESSING;
}).toList(),
...DecorationData.getModels(DecorationType.HAND_OUT),
];
}
List get doneThings {
final fixProvider = Provider.of<FixProvider>(context, listen: false);
return [
...fixProvider.fixModels.where((element) {
return element.type == FIX_ENUM.DONE;
}).toList(),
...DecorationData.getModels(DecorationType.DONE),
];
}
}

@ -1,8 +1,16 @@
import 'package:aku_community_manager/mock_models/all_model.dart';
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/fix/fix_model.dart';
import 'package:aku_community_manager/provider/fix_provider.dart';
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_fix_card.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:flutter/material.dart';
import 'package:aku_community_manager/tools/screen_tool.dart';
import 'package:provider/provider.dart';
class BusinessPage extends StatefulWidget {
///DEFAULT IS 0
@ -47,17 +55,29 @@ class _BusinessPageState extends State<BusinessPage>
),
body: TabBarView(
controller: _tabController,
children: _tabs.map((e) => _buildTabPage(_tabs.indexOf(e))).toList(),
children: [
_buildTabPage(AllModel(context).waitThings),
_buildTabPage(AllModel(context).processingThings),
_buildTabPage(AllModel(context).doneThings),
_buildTabPage(AllModel(context).allThings),
],
),
);
}
Widget _buildTabPage(int index) {
Widget _buildTabPage(List list) {
return ListView.builder(
padding: EdgeInsets.symmetric(horizontal: 32.w),
itemBuilder: (context, index) {
return Text(index.toString());
final item = list[index];
if (item is DecorationModel) {
return DecorationManagerCard(model: item);
} else if (item is FixModel) {
return BusinessFixCard(model: item);
} else
return SizedBox();
},
itemCount: 50,
itemCount: list.length,
);
}
}

@ -1,4 +1,7 @@
import 'package:aku_community_manager/const/resource.dart';
import 'package:aku_community_manager/mock_models/all_model.dart';
import 'package:aku_community_manager/mock_models/decoration/decoration_model.dart';
import 'package:aku_community_manager/mock_models/fix/fix_model.dart';
import 'package:aku_community_manager/provider/app_provider.dart';
import 'package:aku_community_manager/provider/user_provider.dart';
import 'package:aku_community_manager/style/app_style.dart';
@ -10,6 +13,8 @@ import 'package:aku_community_manager/ui/home/messages/message.dart';
import 'package:aku_community_manager/ui/home/application/applications_page.dart';
import 'package:aku_community_manager/ui/home/personal_draw.dart';
import 'package:aku_community_manager/ui/login/login_page.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_fix_card.dart';
import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_manager_card.dart';
import 'package:aku_community_manager/ui/sub_pages/visitor_manager/visitor_manager_page.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_and_fix_page.dart';
import 'package:aku_community_manager/ui/tool_pages/scan_page.dart';
@ -42,6 +47,7 @@ class _HomePageState extends State<HomePage> {
Provider.of<UserProvider>(context, listen: false);
if (userProvider.isSigned) {
Get.to(page);
if (text != '全部应用')
appProvider.addRecentApp(AppApplication(text, assetPath, page));
} else
Get.to(LoginPage());
@ -71,7 +77,7 @@ class _HomePageState extends State<HomePage> {
///
Widget _card(
String number,
int number,
String text,
Color color,
int index,
@ -92,7 +98,7 @@ class _HomePageState extends State<HomePage> {
height: 32.w,
),
Text(
number,
number == null ? '0' : number.toString(),
style: TextStyle(
color: color,
fontSize: 40.sp,
@ -257,7 +263,10 @@ class _HomePageState extends State<HomePage> {
//
height: double.infinity,
onPressed: () {
if (userProvider.isSigned)
Get.to(Message());
else
Get.to(LoginPage());
},
child: Column(children: [
Image.asset(
@ -389,7 +398,9 @@ class _HomePageState extends State<HomePage> {
),
SizedBox(height: 16.w),
//
Row(
!userProvider.isSigned
? SizedBox()
: Row(
children: [
Text(
'待办事项',
@ -426,14 +437,41 @@ class _HomePageState extends State<HomePage> {
),
SizedBox(height: 16.w),
//
Container(
width: double.infinity,
height: 449.w,
!userProvider.isSigned
? SizedBox()
: Container(
height: 480.w,
child: ListView.separated(
separatorBuilder: (context, index) {
return AkuBox.w(16);
},
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
return Container(
width: 526.w,
child: Builder(
builder: (context) {
final item = AllModel(context).waitThings[index];
if (item is DecorationModel) {
return DecorationManagerCard(model: item);
} else if (item is FixModel) {
return BusinessFixCard(
model: item, homeDisplay: true);
} else
return SizedBox();
},
),
);
},
itemCount: AllModel(context).waitThings.length,
),
//TODO listview
),
SizedBox(height: 24.w),
//
Container(
!userProvider.isSigned
? SizedBox()
: Container(
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
@ -443,9 +481,11 @@ class _HomePageState extends State<HomePage> {
children: [
Row(
children: [
_card('25', '未处理事项', Color(0xFFFF4E0D), 0),
_card(AllModel(context).waitThings?.length, '未处理事项',
Color(0xFFFF4E0D), 0),
AkuDiveder().verticalDivider(166.5.w),
_card('22', '处理中事项', Color(0xFFFFC40C), 1),
_card(AllModel(context).processingThings?.length,
'处理中事项', Color(0xFFFFC40C), 1),
],
),
Row(children: [
@ -454,11 +494,13 @@ class _HomePageState extends State<HomePage> {
]),
Row(
children: [
_card('25', '已处理事项', Color(0xFF3F8FFE), 2),
_card(AllModel(context).doneThings?.length, '已处理事项',
Color(0xFF3F8FFE), 2),
AkuDiveder(isReverse: true).verticalDivider(
166.5.w,
),
_card('72', '全部事项', Color(0xFF333333), 3),
_card(AllModel(context).allThings?.length, '全部事项',
Color(0xFF333333), 3),
],
),
],

@ -61,9 +61,9 @@ class _PersonalDrawState extends State<PersonalDraw> {
//leading
InkWell(
onTap: () {
if (!userProvider.isSigned) {
Get.to(LoginPage());
}
userProvider.isSigned
? Get.to(UserInfoPage())
: Get.to(LoginPage());
},
child: Container(
margin: EdgeInsets.only(bottom: 80.w, top: 40.w),

@ -69,6 +69,7 @@ class _BusinessAndFixPageState extends State<BusinessAndFixPage>
final fixProvider = Provider.of<FixProvider>(context, listen: false);
List<FixModel> models = fixProvider.getFixModel(index, context);
return ListView.builder(
padding: EdgeInsets.symmetric(horizontal: 32.w),
itemBuilder: (context, index) {
return BusinessFixCard(model: models[index]);
},

@ -9,6 +9,7 @@ import 'package:aku_community_manager/ui/sub_pages/business_and_fix/fix_work_fin
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:extended_text/extended_text.dart';
import 'package:flutter/material.dart';
import 'package:aku_community_manager/tools/screen_tool.dart';
import 'package:get/get.dart';
@ -16,7 +17,9 @@ import 'package:provider/provider.dart';
class BusinessFixCard extends StatefulWidget {
final FixModel model;
BusinessFixCard({Key key, @required this.model}) : super(key: key);
final bool homeDisplay;
BusinessFixCard({Key key, @required this.model, this.homeDisplay = false})
: super(key: key);
@override
_BusinessFixCardState createState() => _BusinessFixCardState();
@ -81,9 +84,13 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
fixTypeWidget,
],
),
AkuBox.h(24),
widget.homeDisplay ? AkuBox.h(12) : AkuBox.h(24),
Text(
widget.model.title,
maxLines: widget.homeDisplay ? 1 : null,
overflow: !widget.homeDisplay
? TextOverflow.visible
: TextOverflow.ellipsis,
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.sp,
@ -95,10 +102,7 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
_buildBottomCard(),
],
),
margin: EdgeInsets.symmetric(
horizontal: 32.w,
vertical: 8.w,
),
margin: EdgeInsets.only(top: 16.w),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8.w),
@ -222,9 +226,7 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
default:
return Column(
children: [
Divider(
height: 48.w,
),
widget.homeDisplay ? Divider(height: 24.w) : Divider(height: 48.w),
Align(
alignment: Alignment.centerRight,
child: AkuMaterialButton(

@ -239,6 +239,8 @@ class _WarningPageState extends State<WarningPage> {
}
_getLocation() {
_location = null;
setState(() {});
PermissionTool.getLocationPermission().then((state) {
if (state) {
AmapLocation.instance.fetchLocation().then((location) {

Loading…
Cancel
Save