From 14d427a06820db40f46089c501859e1cb7b7379a Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Sat, 15 May 2021 17:50:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E4=BA=8C=E6=89=8B?= =?UTF-8?q?=E5=B8=82=E5=9C=BA=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/models/market/goods_item.dart | 9 ++ .../add_second_hand_goods_page.dart | 105 ++++++++++++++++++ .../market/second_hand/second_hand_page.dart | 17 ++- 3 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 lib/ui/market/second_hand/add_second_hand_goods_page.dart diff --git a/lib/models/market/goods_item.dart b/lib/models/market/goods_item.dart index ebd1369a..d50f7741 100644 --- a/lib/models/market/goods_item.dart +++ b/lib/models/market/goods_item.dart @@ -23,6 +23,15 @@ class GoodsItem extends Equatable { required this.subscribeNum, required this.imgList, }); + + factory GoodsItem.example() => GoodsItem( + id: 0, + title: '华为mate30', + recommend: '九成新,无磨损', + sellingPrice: 1000, + markingPrice: 2000, + subscribeNum: 0, + imgList: []); @override List get props => throw UnimplementedError(); diff --git a/lib/ui/market/second_hand/add_second_hand_goods_page.dart b/lib/ui/market/second_hand/add_second_hand_goods_page.dart new file mode 100644 index 00000000..d98f36e9 --- /dev/null +++ b/lib/ui/market/second_hand/add_second_hand_goods_page.dart @@ -0,0 +1,105 @@ +import 'dart:io'; + +import 'package:aku_community/base/base_style.dart'; +import 'package:aku_community/widget/bee_scaffold.dart'; +import 'package:aku_community/widget/buttons/bottom_button.dart'; +import 'package:aku_community/widget/picker/grid_image_picker.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class AddSecondGoodsPage extends StatefulWidget { + AddSecondGoodsPage({Key? key}) : super(key: key); + + @override + _AddSecondGoodsPageState createState() => _AddSecondGoodsPageState(); +} + +class _AddSecondGoodsPageState extends State { + late TextEditingController _titleController; + late TextEditingController _contentController; + List _files = []; + @override + void initState() { + super.initState(); + _titleController = TextEditingController(); + _contentController = TextEditingController(); + } + + @override + Widget build(BuildContext context) { + return BeeScaffold( + title: '添加商品', + // actions: [ + // Padding( + // padding: EdgeInsets.all(32.w), + // child: '提交'.text.size(28.sp).color(ktextPrimary).make(), + // ), + // ], + body: ListView( + padding: EdgeInsets.symmetric(vertical: 32.w, horizontal: 32.w), + children: [ + Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.w)), + width: double.infinity, + padding: EdgeInsets.symmetric(vertical: 26.w, horizontal: 32.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: TextField( + controller: _titleController, + maxLines: 1, + decoration: InputDecoration( + enabledBorder: UnderlineInputBorder( + borderSide: BorderSide( + color: Color(0xFFEEEEEE), + width: 2.w, + ), + ), + contentPadding: EdgeInsets.only(bottom: 10.w), + isDense: true, + hintText: '请输入标题', + hintStyle: TextStyle( + color: ktextSubColor, + fontSize: 36.sp, + ), + ), + ), + ), + ], + ), + 20.w.heightBox, + TextField( + controller: _contentController, + decoration: InputDecoration( + border: InputBorder.none, + contentPadding: EdgeInsets.zero, + isDense: true, + hintText: '请输入描述信息,至少五个字', + hintStyle: TextStyle( + color: ktextSubColor, + fontSize: 28.sp, + ), + ), + minLines: 5, + maxLines: 10, + ), + GridImagePicker(onChange: (files) { + _files = files; + }), + ], + ), + ), + ]), + bottomNavi: BottomButton( + onPressed: () {}, + child: '立即提交'.text.size(32.sp).color(ktextPrimary).bold.make(), + ), + ); + } +} diff --git a/lib/ui/market/second_hand/second_hand_page.dart b/lib/ui/market/second_hand/second_hand_page.dart index 802bd08f..a97f5c44 100644 --- a/lib/ui/market/second_hand/second_hand_page.dart +++ b/lib/ui/market/second_hand/second_hand_page.dart @@ -1,6 +1,12 @@ +import 'package:aku_community/models/market/goods_item.dart'; +import 'package:aku_community/ui/market/goods/goods_card.dart'; +import 'package:aku_community/ui/market/second_hand/add_second_hand_goods_page.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:waterfall_flow/waterfall_flow.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; class SecondHandPage extends StatefulWidget { SecondHandPage({Key? key}) : super(key: key); @@ -19,9 +25,18 @@ class _SecondHandPageState extends State { icon: Icon( CupertinoIcons.add_circled, ), - onPressed: () {}, + onPressed: () { + Get.to(() => AddSecondGoodsPage()); + }, ), ], + body: WaterfallFlow.count( + crossAxisCount: 2, + mainAxisSpacing: 20.w, + crossAxisSpacing: 20.w, + padding: EdgeInsets.all(32.w), + children: [GoodsCard(item: GoodsItem.example())], + ), ); } }