棉花app新增页面
This commit is contained in:
264
lib/pages/device_control/address_module_widget.dart
Normal file
264
lib/pages/device_control/address_module_widget.dart
Normal file
@@ -0,0 +1,264 @@
|
||||
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/controller/mh/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(15, 0, 15, 0),
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 100,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
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(15, 13, 15, 10),
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
height: MediaQuery.sizeOf(context).height * 0.123,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
height: MediaQuery.sizeOf(context).height * 0.08,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 112,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
width: MediaQuery.sizeOf(context).width * 0.7,
|
||||
height:
|
||||
MediaQuery.sizeOf(context).height * 0.08,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 112,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(-1, 0),
|
||||
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: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0xFF333333),
|
||||
fontSize: AppFontsize
|
||||
.normal_text_size,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(-1, 0),
|
||||
child: Text(
|
||||
addressListController
|
||||
.model
|
||||
.addressList[index]
|
||||
['detail']
|
||||
?.isEmpty ??
|
||||
true
|
||||
? '无详细地址'
|
||||
: addressListController.model
|
||||
.addressList[index]['detail'],
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0xFF333333),
|
||||
fontSize: AppFontsize
|
||||
.normal_text_size,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(-1, 0),
|
||||
child: Text(
|
||||
'${addressListController.model.addressList[index]['name']} ' +
|
||||
'${addressListController.model.addressList[index]['phone']} ',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0xFF333333),
|
||||
fontSize: AppFontsize
|
||||
.normal_text_size,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(height: 5)),
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: AlignmentDirectional(1, -1),
|
||||
child: Theme(
|
||||
data: ThemeData(
|
||||
checkboxTheme: CheckboxThemeData(
|
||||
visualDensity: VisualDensity.compact,
|
||||
materialTapTargetSize:
|
||||
MaterialTapTargetSize.shrinkWrap,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(64),
|
||||
),
|
||||
),
|
||||
unselectedWidgetColor: Color(0xFFD3D3D3),
|
||||
),
|
||||
child: Obx(() {
|
||||
return Checkbox(
|
||||
value: addressListController
|
||||
.model.addressList[index]
|
||||
['isChecked'] ??
|
||||
false,
|
||||
onChanged: (newValue) async {
|
||||
// if (newValue == true) {
|
||||
// for (var i = 0;
|
||||
// i <
|
||||
// addressListController
|
||||
// .model.addressList.length;
|
||||
// i++) {
|
||||
// addressListController
|
||||
// .model.addressList[i]
|
||||
// ['isChecked'] = false;
|
||||
// }
|
||||
// addressListController
|
||||
// .model.addressList[index]
|
||||
// ['isChecked'] = newValue;
|
||||
// addressListController.updateDefault(
|
||||
// addressListController
|
||||
// .model.addressList[index]);
|
||||
// }
|
||||
// addressListController.updateAll();
|
||||
},
|
||||
side: BorderSide(
|
||||
width: 1.5,
|
||||
color: FlutterFlowTheme.of(context)
|
||||
.secondaryText,
|
||||
),
|
||||
activeColor: const Color(0xFFd3b684),
|
||||
checkColor:
|
||||
FlutterFlowTheme.of(context).info,
|
||||
);
|
||||
}),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: AlignmentDirectional(1, 0),
|
||||
child: 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: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0xFF9EA4B7),
|
||||
fontSize: AppFontsize.small_text_size,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user