Merge branch 'dev'

* dev:
  update homepage
hmxc
小赖 4 years ago
commit 1f2423ac1f

@ -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/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/common/aku_scaffold.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_tab_bar.dart'; import 'package:aku_community_manager/ui/widgets/inner/aku_tab_bar.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:aku_community_manager/tools/screen_tool.dart'; import 'package:aku_community_manager/tools/screen_tool.dart';
import 'package:provider/provider.dart';
class BusinessPage extends StatefulWidget { class BusinessPage extends StatefulWidget {
///DEFAULT IS 0 ///DEFAULT IS 0
@ -47,17 +55,29 @@ class _BusinessPageState extends State<BusinessPage>
), ),
body: TabBarView( body: TabBarView(
controller: _tabController, 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( return ListView.builder(
padding: EdgeInsets.symmetric(horizontal: 32.w),
itemBuilder: (context, index) { 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/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/app_provider.dart';
import 'package:aku_community_manager/provider/user_provider.dart'; import 'package:aku_community_manager/provider/user_provider.dart';
import 'package:aku_community_manager/style/app_style.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/application/applications_page.dart';
import 'package:aku_community_manager/ui/home/personal_draw.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/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/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/sub_pages/business_and_fix/business_and_fix_page.dart';
import 'package:aku_community_manager/ui/tool_pages/scan_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); Provider.of<UserProvider>(context, listen: false);
if (userProvider.isSigned) { if (userProvider.isSigned) {
Get.to(page); Get.to(page);
if (text != '全部应用')
appProvider.addRecentApp(AppApplication(text, assetPath, page)); appProvider.addRecentApp(AppApplication(text, assetPath, page));
} else } else
Get.to(LoginPage()); Get.to(LoginPage());
@ -71,7 +77,7 @@ class _HomePageState extends State<HomePage> {
/// ///
Widget _card( Widget _card(
String number, int number,
String text, String text,
Color color, Color color,
int index, int index,
@ -92,7 +98,7 @@ class _HomePageState extends State<HomePage> {
height: 32.w, height: 32.w,
), ),
Text( Text(
number, number == null ? '0' : number.toString(),
style: TextStyle( style: TextStyle(
color: color, color: color,
fontSize: 40.sp, fontSize: 40.sp,
@ -257,7 +263,10 @@ class _HomePageState extends State<HomePage> {
// //
height: double.infinity, height: double.infinity,
onPressed: () { onPressed: () {
if (userProvider.isSigned)
Get.to(Message()); Get.to(Message());
else
Get.to(LoginPage());
}, },
child: Column(children: [ child: Column(children: [
Image.asset( Image.asset(
@ -389,7 +398,9 @@ class _HomePageState extends State<HomePage> {
), ),
SizedBox(height: 16.w), SizedBox(height: 16.w),
// //
Row( !userProvider.isSigned
? SizedBox()
: Row(
children: [ children: [
Text( Text(
'待办事项', '待办事项',
@ -426,14 +437,41 @@ class _HomePageState extends State<HomePage> {
), ),
SizedBox(height: 16.w), SizedBox(height: 16.w),
// //
Container( !userProvider.isSigned
width: double.infinity, ? SizedBox()
height: 449.w, : 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 //TODO listview
), ),
SizedBox(height: 24.w), SizedBox(height: 24.w),
// //
Container( !userProvider.isSigned
? SizedBox()
: Container(
width: double.infinity, width: double.infinity,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w), borderRadius: BorderRadius.circular(8.w),
@ -443,9 +481,11 @@ class _HomePageState extends State<HomePage> {
children: [ children: [
Row( Row(
children: [ children: [
_card('25', '未处理事项', Color(0xFFFF4E0D), 0), _card(AllModel(context).waitThings?.length, '未处理事项',
Color(0xFFFF4E0D), 0),
AkuDiveder().verticalDivider(166.5.w), AkuDiveder().verticalDivider(166.5.w),
_card('22', '处理中事项', Color(0xFFFFC40C), 1), _card(AllModel(context).processingThings?.length,
'处理中事项', Color(0xFFFFC40C), 1),
], ],
), ),
Row(children: [ Row(children: [
@ -454,11 +494,13 @@ class _HomePageState extends State<HomePage> {
]), ]),
Row( Row(
children: [ children: [
_card('25', '已处理事项', Color(0xFF3F8FFE), 2), _card(AllModel(context).doneThings?.length, '已处理事项',
Color(0xFF3F8FFE), 2),
AkuDiveder(isReverse: true).verticalDivider( AkuDiveder(isReverse: true).verticalDivider(
166.5.w, 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 //leading
InkWell( InkWell(
onTap: () { onTap: () {
if (!userProvider.isSigned) { userProvider.isSigned
Get.to(LoginPage()); ? Get.to(UserInfoPage())
} : Get.to(LoginPage());
}, },
child: Container( child: Container(
margin: EdgeInsets.only(bottom: 80.w, top: 40.w), 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); final fixProvider = Provider.of<FixProvider>(context, listen: false);
List<FixModel> models = fixProvider.getFixModel(index, context); List<FixModel> models = fixProvider.getFixModel(index, context);
return ListView.builder( return ListView.builder(
padding: EdgeInsets.symmetric(horizontal: 32.w),
itemBuilder: (context, index) { itemBuilder: (context, index) {
return BusinessFixCard(model: models[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_community_manager/ui/widgets/inner/aku_chip_box.dart';
import 'package:aku_ui/common_widgets/aku_material_button.dart'; import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:common_utils/common_utils.dart'; import 'package:common_utils/common_utils.dart';
import 'package:extended_text/extended_text.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:aku_community_manager/tools/screen_tool.dart'; import 'package:aku_community_manager/tools/screen_tool.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -16,7 +17,9 @@ import 'package:provider/provider.dart';
class BusinessFixCard extends StatefulWidget { class BusinessFixCard extends StatefulWidget {
final FixModel model; 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 @override
_BusinessFixCardState createState() => _BusinessFixCardState(); _BusinessFixCardState createState() => _BusinessFixCardState();
@ -81,9 +84,13 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
fixTypeWidget, fixTypeWidget,
], ],
), ),
AkuBox.h(24), widget.homeDisplay ? AkuBox.h(12) : AkuBox.h(24),
Text( Text(
widget.model.title, widget.model.title,
maxLines: widget.homeDisplay ? 1 : null,
overflow: !widget.homeDisplay
? TextOverflow.visible
: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
color: AppStyle.primaryTextColor, color: AppStyle.primaryTextColor,
fontSize: 28.sp, fontSize: 28.sp,
@ -95,10 +102,7 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
_buildBottomCard(), _buildBottomCard(),
], ],
), ),
margin: EdgeInsets.symmetric( margin: EdgeInsets.only(top: 16.w),
horizontal: 32.w,
vertical: 8.w,
),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(8.w), borderRadius: BorderRadius.circular(8.w),
@ -222,9 +226,7 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
default: default:
return Column( return Column(
children: [ children: [
Divider( widget.homeDisplay ? Divider(height: 24.w) : Divider(height: 48.w),
height: 48.w,
),
Align( Align(
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
child: AkuMaterialButton( child: AkuMaterialButton(

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

Loading…
Cancel
Save