From 5179ae3bba991113464a18f31190b745127ff386 Mon Sep 17 00:00:00 2001 From: laiiihz Date: Mon, 8 Feb 2021 15:55:26 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=86=99=E9=A6=96=E9=A1=B5=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E5=8D=A1=E7=89=87=E8=83=8C=E6=99=AF=EF=BC=8C=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E9=A6=96=E9=A1=B5=E6=BB=9A=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/home/home_page.dart | 31 +++---------------- lib/pages/home/widget/home_swiper.dart | 2 ++ lib/pages/property/property_index.dart | 7 ++--- lib/widget/container_comment.dart | 42 -------------------------- lib/widget/views/application_box.dart | 30 ++++++++++++++++++ 5 files changed, 39 insertions(+), 73 deletions(-) delete mode 100644 lib/widget/container_comment.dart create mode 100644 lib/widget/views/application_box.dart diff --git a/lib/pages/home/home_page.dart b/lib/pages/home/home_page.dart index 6f8a39fe..e6def9e9 100644 --- a/lib/pages/home/home_page.dart +++ b/lib/pages/home/home_page.dart @@ -27,7 +27,7 @@ import 'package:akuCommunity/ui/home/home_notification.dart'; import 'package:akuCommunity/ui/home/home_title.dart'; import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/widget/buttons/column_action_button.dart'; -import 'package:akuCommunity/widget/container_comment.dart'; +import 'package:akuCommunity/widget/views/application_box.dart'; import 'package:akuCommunity/widget/views/application_view.dart'; import 'widget/home_search.dart'; import 'widget/home_swiper.dart'; @@ -59,29 +59,9 @@ class _HomePageState extends State @override void initState() { super.initState(); - Future loadString = - DefaultAssetBundle.of(context).loadString("assets/json/shop.json"); - loadString.then((String value) { - // 通知框架此对象的内部状态已更改 - akuShop(value); - }); - // akuShop(page); _scrollController = ScrollController(); } - Future akuShop(String response) async { - Map result = json.decode(response.toString()); - BaseModel model = BaseModel.fromJson(result); - model.result.forEach((item) { - item["count"] = 1; - item["isCheck"] = false; - AkuShopModel list = AkuShopModel.fromJson(item); - setState(() { - _shopList.add(list); - }); - }); - } - @override Widget build(BuildContext context) { super.build(context); @@ -116,12 +96,9 @@ class _HomePageState extends State mainAxisSize: MainAxisSize.min, children: [ HomeSearch(), - HomeSwiper(), - SizedBox(height: 100.w), - ContainerComment( - radius: 8, - customWidget: ApplicationView(), - ), + // HomeSwiper(), + // SizedBox(height: 100.w), + ApplicationBox(child: ApplicationView()), // SingleAdSpace( // imagePath: R.ASSETS_EXAMPLE_GUANGGAO2_PNG, // ), diff --git a/lib/pages/home/widget/home_swiper.dart b/lib/pages/home/widget/home_swiper.dart index 8e6fef77..e0ecf0b5 100644 --- a/lib/pages/home/widget/home_swiper.dart +++ b/lib/pages/home/widget/home_swiper.dart @@ -9,6 +9,8 @@ import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/widget/cached_image_wrapper.dart'; +//TODO CLEAN BOTTOM CODES. +@Deprecated("sh*t home_swiper need to be cleaned.") class HomeSwiper extends StatefulWidget { HomeSwiper({Key key}) : super(key: key); diff --git a/lib/pages/property/property_index.dart b/lib/pages/property/property_index.dart index ddc99ffd..9371a6a1 100644 --- a/lib/pages/property/property_index.dart +++ b/lib/pages/property/property_index.dart @@ -1,4 +1,5 @@ // Flutter imports: +import 'package:akuCommunity/widget/views/application_box.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -14,7 +15,6 @@ import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/utils/network/base_list_model.dart'; import 'package:akuCommunity/utils/network/net_util.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart'; -import 'package:akuCommunity/widget/container_comment.dart'; import 'package:akuCommunity/widget/views/application_view.dart'; import 'widget/property_card.dart'; @@ -80,9 +80,8 @@ class _PropertyIndexState extends State child: CustomScrollView( slivers: [ SliverToBoxAdapter( - child: ContainerComment( - radius: 8, - customWidget: ApplicationView.custom(items: smartManagerApp), + child: ApplicationBox( + child: ApplicationView.custom(items: smartManagerApp), ), ), SliverToBoxAdapter( diff --git a/lib/widget/container_comment.dart b/lib/widget/container_comment.dart deleted file mode 100644 index c6fc52e3..00000000 --- a/lib/widget/container_comment.dart +++ /dev/null @@ -1,42 +0,0 @@ -// Flutter imports: -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:flutter_screenutil/flutter_screenutil.dart'; - -//TODO CLEAN BOTTOM CODES. -@Deprecated("sh*t container_comment need to be cleaned.") -class ContainerComment extends StatelessWidget { - final Widget customWidget; - final double radius; - ContainerComment({Key key, this.customWidget, this.radius = 0}) - : super(key: key); - - @override - Widget build(BuildContext context) { - return Container( - margin: EdgeInsets.symmetric( - horizontal: 32.w, - vertical: 17.w, - ), - padding: EdgeInsets.symmetric( - horizontal: 24.w, - vertical: 16.w, - ), - alignment: Alignment.center, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(radius)), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.2), - offset: Offset(1.1, 1.1), - blurRadius: 10.0, - ), - ], - ), - child: customWidget, - ); - } -} diff --git a/lib/widget/views/application_box.dart b/lib/widget/views/application_box.dart new file mode 100644 index 00000000..43316c72 --- /dev/null +++ b/lib/widget/views/application_box.dart @@ -0,0 +1,30 @@ +// Flutter imports: +import 'package:akuCommunity/utils/headers.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +// Package imports: +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class ApplicationBox extends StatelessWidget { + final Widget child; + ApplicationBox({Key key, this.child}) : super(key: key); + + @override + Widget build(BuildContext context) { + return VxBox(child: child) + .margin(EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w)) + .padding(EdgeInsets.all(24.w)) + .color(Colors.white) + .withRounded(value: 8.w) + .withShadow([ + BoxShadow( + color: Colors.grey.withOpacity(0.2), + offset: Offset(1.1, 1.1), + blurRadius: 10.0, + ) + ]) + .make() + .centered(); + } +}