200 lines
8.7 KiB
Dart
200 lines
8.7 KiB
Dart
import 'package:ef/ef.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
|
import 'package:flutter_slidable/flutter_slidable.dart';
|
|
import 'package:vbvs_app/common/util/FitTool.dart';
|
|
import 'package:vbvs_app/controller/mh_controller/address_list_controller.dart';
|
|
import '../../common/color/appFontsize.dart';
|
|
|
|
class AddressModuleWidget extends GetView {
|
|
final int index;
|
|
final AddressListController addressListController;
|
|
|
|
AddressModuleWidget({
|
|
required this.index,
|
|
required this.addressListController,
|
|
}) {}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SingleChildScrollView(
|
|
child: SlidableAutoCloseBehavior(
|
|
child: Padding(
|
|
padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 0, 30.rpx, 0),
|
|
child: Container(
|
|
width: MediaQuery.sizeOf(context).width,
|
|
constraints: BoxConstraints(
|
|
minHeight: 220.rpx,
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: Color(0xFF003058),
|
|
borderRadius: BorderRadius.circular(16),
|
|
),
|
|
child: Slidable(
|
|
endActionPane: ActionPane(
|
|
extentRatio: 0.26,
|
|
motion: ScrollMotion(),
|
|
children: [
|
|
Expanded(
|
|
child: InkWell(
|
|
onTap: () async {
|
|
await addressListController.deleteAddress(
|
|
addressListController.model.addressList[index]
|
|
['_id']);
|
|
addressListController.model.addressList.removeAt(index);
|
|
|
|
addressListController.updateAll();
|
|
},
|
|
child: Container(
|
|
margin: EdgeInsets.only(left: 30),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(10),
|
|
color: Colors.red,
|
|
),
|
|
alignment: Alignment.center,
|
|
child: Icon(
|
|
Icons.delete,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
child: Padding(
|
|
padding: EdgeInsetsDirectional.fromSTEB(
|
|
30.rpx, 20.rpx, 30.rpx, 20.rpx),
|
|
child: Container(
|
|
width: MediaQuery.sizeOf(context).width,
|
|
height: MediaQuery.sizeOf(context).height * 0.123,
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: [
|
|
Container(
|
|
height: 60.rpx,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Expanded(
|
|
child: Text(
|
|
[
|
|
addressListController
|
|
.model.addressList[index]['province'],
|
|
addressListController
|
|
.model.addressList[index]['city'],
|
|
addressListController
|
|
.model.addressList[index]['county'],
|
|
addressListController
|
|
.model.addressList[index]['street']
|
|
]
|
|
.where((element) =>
|
|
element != null && element.isNotEmpty)
|
|
.join(' '),
|
|
style: TextStyle(
|
|
fontFamily: 'Readex Pro',
|
|
color: Colors.white,
|
|
fontSize: AppFontsize.normal_text_size,
|
|
letterSpacing: 0,
|
|
),
|
|
),
|
|
),
|
|
Obx(() => Visibility(
|
|
visible: addressListController.model
|
|
.addressList[index]["default"] ==
|
|
1,
|
|
child: Container(
|
|
width: 71.rpx,
|
|
height: 36.rpx,
|
|
child: ElevatedButton(
|
|
onPressed: () {},
|
|
child: Text(
|
|
'默认',
|
|
style: TextStyle(
|
|
color: Color(0XFF6BFDAC),
|
|
fontSize: 20.rpx,
|
|
),
|
|
),
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor:
|
|
const Color(0x4D6BFDAC),
|
|
padding: EdgeInsets.zero,
|
|
),
|
|
),
|
|
),
|
|
))
|
|
],
|
|
)),
|
|
Container(
|
|
height: 60.rpx,
|
|
alignment: Alignment.centerLeft,
|
|
child: Text(
|
|
addressListController.model
|
|
.addressList[index]['address']?.isEmpty ??
|
|
true
|
|
? '无详细地址'
|
|
: addressListController.model.addressList[index]
|
|
['address'],
|
|
style: TextStyle(
|
|
fontFamily: 'Readex Pro',
|
|
color: Colors.white,
|
|
fontSize: AppFontsize.normal_text_size,
|
|
letterSpacing: 0,
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
height: 60.rpx,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
'${addressListController.model.addressList[index]['name']} ' +
|
|
'${addressListController.model.addressList[index]['tel']} ',
|
|
style: TextStyle(
|
|
fontFamily: 'Readex Pro',
|
|
color: Colors.white,
|
|
fontSize: AppFontsize.normal_text_size,
|
|
letterSpacing: 0,
|
|
),
|
|
),
|
|
InkWell(
|
|
onTap: () {
|
|
addressListController.model.address =
|
|
addressListController
|
|
.model.addressList[index];
|
|
addressListController.model.type = 2;
|
|
Get.toNamed("/editAddressPage");
|
|
},
|
|
child: Container(
|
|
width: 100,
|
|
height:
|
|
MediaQuery.sizeOf(context).height * 0.03,
|
|
child: Align(
|
|
alignment: AlignmentDirectional(1, 0),
|
|
child: Text(
|
|
'编辑',
|
|
style: TextStyle(
|
|
fontFamily: 'Readex Pro',
|
|
color: Color(0xFF84F5FF),
|
|
fontSize: AppFontsize.small_text_size,
|
|
letterSpacing: 0,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|