From e26b7712a052b16148240e0468157eda682f9393 Mon Sep 17 00:00:00 2001 From: laiiihz Date: Mon, 10 May 2021 09:33:45 +0800 Subject: [PATCH] update --- lib/constants/application_objects.dart | 25 ++++----- lib/generated_plugin_registrant.dart | 3 +- lib/pages/personal/personal_page.dart | 73 +++++++++++++------------ lib/provider/app_provider.dart | 7 ++- lib/ui/market/market_page.dart | 76 +++++++++++++++++++++----- pubspec.yaml | 2 + 6 files changed, 120 insertions(+), 66 deletions(-) diff --git a/lib/constants/application_objects.dart b/lib/constants/application_objects.dart index 276587e0..7322e2f2 100644 --- a/lib/constants/application_objects.dart +++ b/lib/constants/application_objects.dart @@ -2,6 +2,8 @@ import 'package:flutter/material.dart'; +import 'package:equatable/equatable.dart'; + import 'package:aku_community/const/resource.dart'; import 'package:aku_community/pages/convenient_phone/convenient_phone_page.dart'; import 'package:aku_community/pages/event_activity/event_voting_page.dart'; @@ -26,7 +28,7 @@ import 'package:aku_community/ui/profile/house/house_owners_page.dart'; ///应用对象 ///Application Object -class AO { +class AO extends Equatable { String title = ''; String path = ''; dynamic page = () => Scaffold(); @@ -48,17 +50,14 @@ class AO { } @override - bool operator ==(Object other) => - other is AO && runtimeType == other.runtimeType && title == other.title; - - @override - int get hashCode => title.hashCode; + List get props => [title]; } ///所有应用 List appObjects = [ - AO('一键开门', R.ASSETS_APPLICATIONS_OEPN_DOOR_PNG, () => Scaffold()), - AO('开门码', R.ASSETS_APPLICATIONS_DOOR_CODE_PNG, () => OpeningCodePage()), + if (false) AO('一键开门', R.ASSETS_APPLICATIONS_OEPN_DOOR_PNG, () => Scaffold()), + if (false) + AO('开门码', R.ASSETS_APPLICATIONS_DOOR_CODE_PNG, () => OpeningCodePage()), AO('访客邀请', R.ASSETS_APPLICATIONS_VISITOR_INVITE_PNG, () => VisitorAccessPage()), AO('报事报修', R.ASSETS_APPLICATIONS_FIX_PNG, () => FixedSubmitPage()), @@ -110,10 +109,10 @@ List userAppObjects = [ AO('我的车位', R.ASSETS_ICONS_USER_ICON_WDCW_PNG, () => CarParkingPage()), AO('我的车', R.ASSETS_ICONS_USER_ICON_WDC_PNG, () => CarManagePage()), AO('社区活动', R.ASSETS_ICONS_USER_ICON_WDSQHD_PNG, () => ActivityListPage()), - AO('我的缴费', R.ASSETS_ICONS_USER_ICON_WDJF_PNG, () => LifePayPage()), - AO('我的报修', R.ASSETS_ICONS_USER_ICON_WDBX_PNG, () => FixedSubmitPage()), - AO('我的地址', R.ASSETS_ICONS_USER_ICON_WDDZ_PNG, () => Scaffold()), - AO('我的管家', R.ASSETS_ICONS_USER_ICON_WDGJ_PNG, () => Scaffold()), + // AO('我的缴费', R.ASSETS_ICONS_USER_ICON_WDJF_PNG, () => LifePayPage()), + // AO('我的报修', R.ASSETS_ICONS_USER_ICON_WDBX_PNG, () => FixedSubmitPage()), + // AO('我的地址', R.ASSETS_ICONS_USER_ICON_WDDZ_PNG, () => Scaffold()), + // AO('我的管家', R.ASSETS_ICONS_USER_ICON_WDGJ_PNG, () => Scaffold()), AO('我的访客', R.ASSETS_ICONS_USER_ICON_WDFK_PNG, () => VisitorAccessPage()), AO('设置', R.ASSETS_ICONS_USER_ICON_SZ_PNG, () => SettingsPage()), ]; @@ -124,7 +123,7 @@ AO allApp = ///为您推荐 original value List _recommendApp = [ - '一键开门', + if (false) '一键开门', '访客邀请', '报事报修', '建议咨询', diff --git a/lib/generated_plugin_registrant.dart b/lib/generated_plugin_registrant.dart index 8e0b1cb0..222a4e7a 100644 --- a/lib/generated_plugin_registrant.dart +++ b/lib/generated_plugin_registrant.dart @@ -6,12 +6,13 @@ import 'package:device_info_plus_web/device_info_plus_web.dart'; import 'package:firebase_core_web/firebase_core_web.dart'; -import 'package:flutter_web_plugins/flutter_web_plugins.dart'; import 'package:image_picker_for_web/image_picker_for_web.dart'; import 'package:package_info_plus_web/package_info_plus_web.dart'; import 'package:shared_preferences_web/shared_preferences_web.dart'; import 'package:url_launcher_web/url_launcher_web.dart'; +import 'package:flutter_web_plugins/flutter_web_plugins.dart'; + // ignore: public_member_api_docs void registerPlugins(Registrar registrar) { DeviceInfoPlusPlugin.registerWith(registrar); diff --git a/lib/pages/personal/personal_page.dart b/lib/pages/personal/personal_page.dart index edcf57c3..5896351f 100644 --- a/lib/pages/personal/personal_page.dart +++ b/lib/pages/personal/personal_page.dart @@ -191,6 +191,42 @@ class _PersonalIndexState extends State Widget build(BuildContext context) { final double _statusHeight = MediaQuery.of(context).padding.top; final userProvider = Provider.of(context); + var orderWidget = SliverToBoxAdapter( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + _containerBar('我的订单'), + GridView( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 5, + ), + shrinkWrap: true, + children: [ + _orderButton( + name: '待付款', + path: R.ASSETS_ICONS_USER_ICON_DFK_PNG, + index: 1, + ), + _orderButton( + name: '待收货', + path: R.ASSETS_ICONS_USER_ICON_DSH_PNG, + index: 2, + ), + _orderButton( + name: '待评价', + path: R.ASSETS_ICONS_USER_ICON_DPJ_PNG, + index: 3, + ), + _orderButton( + name: '售后', + path: R.ASSETS_ICONS_USER_ICON_SH_PNG, + index: 4, + ), + ], + ), + ], + ), + ); return Scaffold( body: EasyRefresh( header: MaterialHeader(), @@ -201,42 +237,7 @@ class _PersonalIndexState extends State child: CustomScrollView( slivers: [ _sliverAppBar(_statusHeight), - SliverToBoxAdapter( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - _containerBar('我的订单'), - GridView( - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 5, - ), - shrinkWrap: true, - children: [ - _orderButton( - name: '待付款', - path: R.ASSETS_ICONS_USER_ICON_DFK_PNG, - index: 1, - ), - _orderButton( - name: '待收货', - path: R.ASSETS_ICONS_USER_ICON_DSH_PNG, - index: 2, - ), - _orderButton( - name: '待评价', - path: R.ASSETS_ICONS_USER_ICON_DPJ_PNG, - index: 3, - ), - _orderButton( - name: '售后', - path: R.ASSETS_ICONS_USER_ICON_SH_PNG, - index: 4, - ), - ], - ), - ], - ), - ), + // orderWidget, SliverToBoxAdapter( child: Container( decoration: BoxDecoration( diff --git a/lib/provider/app_provider.dart b/lib/provider/app_provider.dart index e56cf032..3edaeaf1 100644 --- a/lib/provider/app_provider.dart +++ b/lib/provider/app_provider.dart @@ -1,3 +1,6 @@ +import 'dart:io'; + +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:amap_flutter_location/amap_flutter_location.dart'; @@ -31,7 +34,7 @@ class AppProvider extends ChangeNotifier { /// '便民电话', ///``` List _myApplications = [ - '一键开门', + // '一键开门', '访客邀请', '报事报修', '生活缴费', @@ -141,6 +144,7 @@ class AppProvider extends ChangeNotifier { late AMapFlutterLocation _aMapFlutterLocation; startLocation() { + if (kIsWeb || Platform.isMacOS) return; _aMapFlutterLocation = AMapFlutterLocation(); _aMapFlutterLocation.onLocationChanged().listen((event) { _location = event; @@ -155,6 +159,7 @@ class AppProvider extends ChangeNotifier { } stopLocation() { + if (kIsWeb || Platform.isMacOS) return; _aMapFlutterLocation.stopLocation(); _aMapFlutterLocation.destroy(); } diff --git a/lib/ui/market/market_page.dart b/lib/ui/market/market_page.dart index cec1c244..fbc2c1b1 100644 --- a/lib/ui/market/market_page.dart +++ b/lib/ui/market/market_page.dart @@ -1,3 +1,4 @@ +import 'package:aku_community/base/base_style.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -25,6 +26,11 @@ class _MarketPageState extends State with AutomaticKeepAliveClientMixin, TickerProviderStateMixin { late TabController _tabController; List _marketModels = []; + + Future updateMarketInfo() async { + // List + } + @override void initState() { super.initState(); @@ -75,12 +81,27 @@ class _MarketPageState extends State ], body: NestedScrollView( headerSliverBuilder: (context, value) { + var gridItems = Material( + color: Colors.white, + clipBehavior: Clip.antiAlias, + borderRadius: BorderRadius.circular(8.w), + child: GridView( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 4, + childAspectRatio: 1, + ), + shrinkWrap: true, + children: + _marketModels.map((e) => CategoryCard(model: e)).toList(), + ), + ); return [ SliverAppBar( //AppBar top Widget height //bottom height: 48 - // flexibleSpace的高为 (设备宽 - 边距)/4*2 + 外边距 + bottom高 - expandedHeight: (mediaWidth - 32.w * 2) / 4 * 2 + 16.w * 2 + 48, + // flexibleSpace的高为 (设备宽 - 边距)/4*2 + 外边距 + bottom高 + top热搜栏 + expandedHeight: + (mediaWidth - 32.w * 2) / 4 * 2 + 16.w * 2 + 48 + 68.w, backgroundColor: Colors.transparent, elevation: 0, flexibleSpace: FlexibleSpaceBar( @@ -92,20 +113,45 @@ class _MarketPageState extends State right: 32.w, bottom: 16.w + 48, //底部边距需要加上bottom高 ), - child: Material( - color: Colors.white, - clipBehavior: Clip.antiAlias, - borderRadius: BorderRadius.circular(8.w), - child: GridView( - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 4, - childAspectRatio: 1, + child: Column( + children: [ + SizedBox( + height: 58.w, + child: Row( + children: [ + Text( + '热搜:', + style: TextStyle( + fontSize: 20.sp, + ), + ), + ListView.separated( + scrollDirection: Axis.horizontal, + separatorBuilder: (_, __) => 20.wb, + itemBuilder: (context, index) { + return MaterialButton( + padding: + EdgeInsets.symmetric(horizontal: 40.w), + minWidth: 0, + shape: StadiumBorder( + side: BorderSide( + color: ktextSubColor, + ), + ), + materialTapTargetSize: + MaterialTapTargetSize.shrinkWrap, + onPressed: () {}, + child: Text('123'), + ); + }, + itemCount: 10, + ).expand(), + ], + ), ), - shrinkWrap: true, - children: _marketModels - .map((e) => CategoryCard(model: e)) - .toList(), - ), + 10.hb, + gridItems.expand(), + ], ), ), ), diff --git a/pubspec.yaml b/pubspec.yaml index c3fcdbc7..36577394 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -96,3 +96,5 @@ flutter: import_sorter: emojis: true comments: false + ignored_files: + - \*\/generated_plugin_registrant.dart