add bee divider add fixed add page update some pages fixed some issueshmxc
parent
4a25f07e8a
commit
9b1f35039c
@ -0,0 +1,211 @@
|
||||
import 'package:akuCommunity/base/base_style.dart';
|
||||
import 'package:akuCommunity/provider/user_provider.dart';
|
||||
import 'package:akuCommunity/widget/bee_divider.dart';
|
||||
import 'package:akuCommunity/widget/bee_scaffold.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
import 'package:akuCommunity/const/resource.dart';
|
||||
import 'package:akuCommunity/extensions/widget_list_ext.dart';
|
||||
|
||||
class AddFixedSubmitPage extends StatefulWidget {
|
||||
AddFixedSubmitPage({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_AddFixedSubmitPageState createState() => _AddFixedSubmitPageState();
|
||||
}
|
||||
|
||||
class _AddFixedSubmitPageState extends State<AddFixedSubmitPage> {
|
||||
List<String> _buttons = ['公区保修', '家庭维修'];
|
||||
int _groupValue;
|
||||
Widget _buildHouseCard(
|
||||
String title,
|
||||
String detail,
|
||||
) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(32.w),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
'报修房屋'.text.black.size(28.sp).make(),
|
||||
32.w.heightBox,
|
||||
GestureDetector(
|
||||
onTap: () {},
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
R.ASSETS_ICONS_HOUSE_PNG,
|
||||
width: 60.w,
|
||||
height: 60.w,
|
||||
),
|
||||
40.w.widthBox,
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
title.text.black.size(32.sp).bold.make(),
|
||||
10.w.heightBox,
|
||||
detail.text.black.size(32.sp).bold.make()
|
||||
],
|
||||
),
|
||||
),
|
||||
// Icon(
|
||||
// CupertinoIcons.chevron_forward,
|
||||
// size: 40.w,
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
24.w.heightBox,
|
||||
BeeDivider.horizontal(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _selectButton(
|
||||
String title,
|
||||
int value,
|
||||
) {
|
||||
return FlatButton(
|
||||
minWidth: 200.w,
|
||||
height: 72.w,
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_groupValue = value;
|
||||
});
|
||||
},
|
||||
child: title.text
|
||||
.color(_groupValue == value ? ktextPrimary : ktextSubColor)
|
||||
.size(32.sp)
|
||||
.make(),
|
||||
padding: EdgeInsets.symmetric(horizontal: 34.w, vertical: 14.w),
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(
|
||||
color: _groupValue == value ? kPrimaryColor : ktextSubColor,
|
||||
width: 3.w),
|
||||
borderRadius: BorderRadius.circular(36.w)),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _selectType() {
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(32.w),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
'请选择服务类型'.text.black.size(28.sp).make(),
|
||||
24.w.heightBox,
|
||||
Row(
|
||||
children: <Widget>[
|
||||
...List.generate(_buttons.length,
|
||||
(index) => _selectButton(_buttons[index], index)),
|
||||
].sepWidget(separate: 20.w.widthBox),
|
||||
),
|
||||
16.w.heightBox,
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildReportCard() {
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(32.w),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
'请输入报修内容'.text.black.size(28.sp).make(),
|
||||
24.w.heightBox,
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8.w),
|
||||
border: Border.all(color: Color(0xFFD4CFBE), width: 1.w)),
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 304.w,
|
||||
),
|
||||
width: 686.w,
|
||||
child: TextField(
|
||||
maxLines: 10,
|
||||
minLines: 5,
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
hintText: '请简要描述一下你要告知我的事情,以便于我们更好的处理……',
|
||||
hintStyle: TextStyle(color: ktextSubColor, fontSize: 28.sp),
|
||||
contentPadding: EdgeInsets.zero,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _addImages() {
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(32.w),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
'添加图片信息(${0}/9)'.text.black.size(28.sp).make(),
|
||||
24.w.heightBox,
|
||||
Row(
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {},
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
width: 218.w,
|
||||
height: 218.w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8.w),
|
||||
border: Border.all(color: Color(0xFF979797), width: 1.w),
|
||||
),
|
||||
child: '+'.text.black.size(100).bold.make(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
UserProvider userProvider = Provider.of<UserProvider>(context);
|
||||
return BeeScaffold(
|
||||
title: '报事报修',
|
||||
body: Column(
|
||||
children: [
|
||||
ListView(
|
||||
children: [
|
||||
_buildHouseCard(
|
||||
kEstateName,
|
||||
userProvider.userDetailModel.estateNames.isEmpty
|
||||
? ''
|
||||
: userProvider.userDetailModel.estateNames[0]),
|
||||
_selectType(),
|
||||
_buildReportCard(),
|
||||
_addImages(),
|
||||
],
|
||||
).expand(),
|
||||
MaterialButton(
|
||||
minWidth: double.infinity,
|
||||
height: 98.w,
|
||||
onPressed: () {},
|
||||
child: '确认提交'.text.black.bold.size(32.sp).make(),
|
||||
color: kPrimaryColor,
|
||||
elevation: 0,
|
||||
)
|
||||
.box
|
||||
.padding(EdgeInsets.only(
|
||||
bottom: MediaQuery.of(context).padding.bottom))
|
||||
.make()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
import 'dart:math';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:akuCommunity/utils/fade_route.dart';
|
||||
import 'package:akuCommunity/widget/gallery_photo_view_wrapper.dart';
|
||||
|
||||
class ImageGrid extends StatelessWidget {
|
||||
final List<String> imageUrl;
|
||||
ImageGrid(this.imageUrl, {Key key}) : super(key: key);
|
||||
|
||||
final Random _random = new Random();
|
||||
int next(int min, int max) => min + _random.nextInt(max - min);
|
||||
List imageModel() {
|
||||
List imgList = List();
|
||||
for (int x = 0; x < imageUrl.length; x++) {
|
||||
GalleryExampleItem item = GalleryExampleItem();
|
||||
item.id = '${next(x + 100, x + 1000)}';
|
||||
item.resource = imageUrl[x];
|
||||
imgList.add(item);
|
||||
}
|
||||
|
||||
return imgList;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
child: GridView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 4,
|
||||
crossAxisSpacing: 5,
|
||||
mainAxisSpacing: 5,
|
||||
),
|
||||
itemCount: imageUrl.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return AspectRatio(
|
||||
aspectRatio: 1,
|
||||
child: GalleryExampleItemThumbnail(
|
||||
galleryExampleItem: imageModel()[index],
|
||||
onTap: () {
|
||||
Navigator.of(context).push(new FadeRoute(
|
||||
page: GalleryPhotoViewWrapper(
|
||||
galleryItems: imageModel(),
|
||||
backgroundDecoration: const BoxDecoration(
|
||||
color: Colors.black,
|
||||
),
|
||||
initialIndex: index,
|
||||
),
|
||||
));
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
|
||||
class BeeDivider extends StatelessWidget {
|
||||
final double thickness;
|
||||
final double indent;
|
||||
final double endIndent;
|
||||
final Color color;
|
||||
final bool isHorizontal;
|
||||
BeeDivider(
|
||||
{Key key,
|
||||
this.thickness,
|
||||
this.indent,
|
||||
this.endIndent,
|
||||
this.color,
|
||||
this.isHorizontal})
|
||||
: super(key: key);
|
||||
BeeDivider.horizontal({
|
||||
Key key,
|
||||
}) : indent = 0,
|
||||
endIndent = 0,
|
||||
thickness = 1.w,
|
||||
color = Color(0xFFE8E8E8),
|
||||
isHorizontal = true,
|
||||
super(key: key);
|
||||
BeeDivider.vertical({
|
||||
Key key,
|
||||
}) : indent = 0,
|
||||
endIndent = 0,
|
||||
thickness = 1.w,
|
||||
color = Color(0xFFE8E8E8),
|
||||
isHorizontal = false,
|
||||
super(key: key);
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return isHorizontal
|
||||
? Divider(
|
||||
height: 0,
|
||||
thickness: this.thickness ?? 1.w,
|
||||
indent: this.indent ?? 0,
|
||||
endIndent: this.endIndent ?? 0,
|
||||
color: this.color ?? Color(0xFFE8E8E8),
|
||||
)
|
||||
: VerticalDivider(
|
||||
width: 0,
|
||||
thickness: this.thickness ?? 1.w,
|
||||
indent: this.indent ?? 0,
|
||||
endIndent: this.endIndent ?? 0,
|
||||
color: this.color ?? Color(0xFFE8E8E8),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
import 'dart:math';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:akuCommunity/utils/fade_route.dart';
|
||||
import 'package:akuCommunity/widget/gallery_photo_view_wrapper.dart';
|
||||
|
||||
class ImageGrid extends StatelessWidget {
|
||||
final List<String> imageUrl;
|
||||
ImageGrid(this.imageUrl, {Key key}) : super(key: key);
|
||||
|
||||
final Random _random = new Random();
|
||||
int next(int min, int max) => min + _random.nextInt(max - min);
|
||||
List imageModel() {
|
||||
List imgList = List();
|
||||
for (int x = 0; x < imageUrl.length; x++) {
|
||||
GalleryExampleItem item = GalleryExampleItem();
|
||||
item.id = '${next(x + 100, x + 1000)}';
|
||||
item.resource = imageUrl[x];
|
||||
imgList.add(item);
|
||||
}
|
||||
|
||||
return imgList;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
child: GridView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 4,
|
||||
crossAxisSpacing: 5,
|
||||
mainAxisSpacing: 5,
|
||||
),
|
||||
itemCount: imageUrl.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return AspectRatio(
|
||||
aspectRatio: 1,
|
||||
child: GalleryExampleItemThumbnail(
|
||||
galleryExampleItem: imageModel()[index],
|
||||
onTap: () {
|
||||
Navigator.of(context).push(new FadeRoute(
|
||||
page: GalleryPhotoViewWrapper(
|
||||
galleryItems: imageModel(),
|
||||
backgroundDecoration: const BoxDecoration(
|
||||
color: Colors.black,
|
||||
),
|
||||
initialIndex: index,
|
||||
),
|
||||
));
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue