对接 智慧养老

fix bugs
pull/1/head
张萌 3 years ago
parent 53ee58cf1c
commit 4deeb6ab10

@ -58,6 +58,12 @@ class _City {
class _Bracelet { class _Bracelet {
/// ///
String get data => '/app/user/elderlyCareEquipment/getAqgData'; String get data => '/app/user/elderlyCareEquipment/getAqgData';
///
String get add => '/app/user/elderlyCareEquipment/bind';
///
String get list => '/app/user/elderlyCareEquipment/list';
} }
class _User { class _User {

@ -1,3 +1,4 @@
import 'package:aku_new_community/provider/old_age_provider.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -40,6 +41,7 @@ class _MyAppState extends State<MyApp> {
ChangeNotifierProvider(create: (context) => SignUpProvider()), ChangeNotifierProvider(create: (context) => SignUpProvider()),
ChangeNotifierProvider(create: (context) => DataProvider()), ChangeNotifierProvider(create: (context) => DataProvider()),
ChangeNotifierProvider(create: (context) => ClockTimerProvider()), ChangeNotifierProvider(create: (context) => ClockTimerProvider()),
ChangeNotifierProvider(create: (context) => OldAgeProvider()),
], ],
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {

@ -0,0 +1,33 @@
import 'package:aku_new_community/pages/services/old_age/old_enum.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:equatable/equatable.dart';
part 'bracelet_list_model.g.dart';
@JsonSerializable()
class BraceletListModel extends Equatable {
final int id;
final int type;
final String deviceType;
final String imei;
factory BraceletListModel.fromJson(Map<String, dynamic> json) =>
_$BraceletListModelFromJson(json);
BraceletBrand get braceletBrand => BraceletBrand.getValue(type);
const BraceletListModel({
required this.id,
required this.type,
required this.deviceType,
required this.imei,
});
@override
List<Object?> get props => [
id,
type,
deviceType,
imei,
];
}

@ -1,11 +1,15 @@
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
part of 'test.dart'; part of 'bracelet_list_model.dart';
// ************************************************************************** // **************************************************************************
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
Test _$TestFromJson(Map<String, dynamic> json) => Test( BraceletListModel _$BraceletListModelFromJson(Map<String, dynamic> json) =>
BraceletListModel(
id: json['id'] as int, id: json['id'] as int,
type: json['type'] as int,
deviceType: json['deviceType'] as String,
imei: json['imei'] as String,
); );

@ -1,20 +0,0 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:equatable/equatable.dart';
part 'test.g.dart';
@JsonSerializable()
class Test extends Equatable {
final int id;
factory Test.fromJson(Map<String, dynamic> json) => _$TestFromJson(json);
@override
List<Object?> get props => [
id,
];
const Test({
required this.id,
});
}

@ -1,3 +1,5 @@
import 'package:aku_new_community/extensions/widget_list_ext.dart';
import 'package:aku_new_community/widget/bee_divider.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -31,6 +33,7 @@ class _BalanceRecordViewState extends State<BalanceRecordView> {
int _pickType = 0; int _pickType = 0;
Map<int, String> _types = { Map<int, String> _types = {
0: '全部',
1: '支付', 1: '支付',
2: '退还', 2: '退还',
3: '充值', 3: '充值',
@ -89,7 +92,7 @@ class _BalanceRecordViewState extends State<BalanceRecordView> {
return BeePickerBox( return BeePickerBox(
onPressed: () { onPressed: () {
Get.back(); Get.back();
setState(() {}); _refreshController.callRefresh();
}, },
child: CupertinoPicker.builder( child: CupertinoPicker.builder(
itemExtent: 60.w, itemExtent: 60.w,
@ -142,7 +145,7 @@ class _BalanceRecordViewState extends State<BalanceRecordView> {
.getList(SAASAPI.balance.tradeRecordList, params: { .getList(SAASAPI.balance.tradeRecordList, params: {
'pageNum': _pageNum, 'pageNum': _pageNum,
'size': _size, 'size': _size,
'modelType': 0, 'modelType': 1,
'type': _pickType == 0 ? null : _pickType, 'type': _pickType == 0 ? null : _pickType,
'createDate': 'createDate':
DateUtil.formatDate(_pickTime, format: DateFormats.full), DateUtil.formatDate(_pickTime, format: DateFormats.full),
@ -176,7 +179,11 @@ class _BalanceRecordViewState extends State<BalanceRecordView> {
}, },
child: ListView( child: ListView(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w), padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
children: _models.map((e) => _buildCard(e)).toList(), children: _models.map((e) => _buildCard(e)).toList().sepWidget(
separate: Padding(
padding: EdgeInsets.symmetric(vertical: 20.w),
child: BeeDivider(),
)),
), ),
), ),
), ),
@ -189,6 +196,7 @@ class _BalanceRecordViewState extends State<BalanceRecordView> {
Widget _buildCard(TradeRecordListModel model) { Widget _buildCard(TradeRecordListModel model) {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
children: [ children: [

@ -1,3 +1,6 @@
import 'package:aku_new_community/extensions/widget_list_ext.dart';
import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/widget/bee_divider.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -31,6 +34,7 @@ class _PointRecordViewState extends State<PointRecordView> {
int _pickType = 0; int _pickType = 0;
Map<int, String> _types = { Map<int, String> _types = {
0:'全部',
1: '支付', 1: '支付',
2: '退还', 2: '退还',
3: '充值', 3: '充值',
@ -89,7 +93,7 @@ class _PointRecordViewState extends State<PointRecordView> {
return BeePickerBox( return BeePickerBox(
onPressed: () { onPressed: () {
Get.back(); Get.back();
setState(() {}); _refreshController.callRefresh();
}, },
child: CupertinoPicker.builder( child: CupertinoPicker.builder(
itemExtent: 60.w, itemExtent: 60.w,
@ -142,7 +146,7 @@ class _PointRecordViewState extends State<PointRecordView> {
.getList(SAASAPI.balance.tradeRecordList, params: { .getList(SAASAPI.balance.tradeRecordList, params: {
'pageNum': _pageNum, 'pageNum': _pageNum,
'size': _size, 'size': _size,
'modelType': 1, 'modelType': 2,
'type': _pickType == 0 ? null : _pickType, 'type': _pickType == 0 ? null : _pickType,
'createDate': 'createDate':
DateUtil.formatDate(_pickTime, format: DateFormats.full), DateUtil.formatDate(_pickTime, format: DateFormats.full),
@ -175,7 +179,10 @@ class _PointRecordViewState extends State<PointRecordView> {
}, },
child: ListView( child: ListView(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w), padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
children: _models.map((e) => _buildCard(e)).toList(), children: _models.map((e) => _buildCard(e)).toList().sepWidget(separate: Padding(
padding: EdgeInsets.symmetric(vertical: 20.w),
child: BeeDivider(),
)),
), ),
), ),
), ),
@ -188,6 +195,7 @@ class _PointRecordViewState extends State<PointRecordView> {
Widget _buildCard(TradeRecordListModel model) { Widget _buildCard(TradeRecordListModel model) {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
children: [ children: [
@ -197,13 +205,14 @@ class _PointRecordViewState extends State<PointRecordView> {
.color(Colors.black.withOpacity(0.85)) .color(Colors.black.withOpacity(0.85))
.make(), .make(),
Spacer(), Spacer(),
'${incom(model.type) ? '+' : '-'}¥${model.payAmount}' '${incom(model.type) ? '+' : '-'}${model.payAmount.toInt()}'
.text .text
.size(28.sp) .size(28.sp)
.color(incom(model.type) .color(incom(model.type)
? Colors.red ? Colors.red
: Colors.black.withOpacity(0.85)) : Colors.black.withOpacity(0.85))
.make(), .make(),
Assets.icons.intergral.image(width: 32.w,height: 32.w),
], ],
), ),
8.hb, 8.hb,

@ -34,7 +34,7 @@ class _WalletRechargePageState extends State<WalletRechargePage>
late TabController _tabController; late TabController _tabController;
List<String> _tabs = ['余额充值', '积分充值']; List<String> _tabs = ['余额充值', '积分充值'];
List<int> _balanceValue = [10, 20, 30, 50, 00, 200, 300, 500]; List<int> _balanceValue = [10, 20, 30, 50, 100, 200, 300, 500];
List<int> _pointValue = [10, 200, 300, 500, 1000, 2000, 5000, 10000]; List<int> _pointValue = [10, 200, 300, 500, 1000, 2000, 5000, 10000];
int _rechargeValue = 0; int _rechargeValue = 0;

@ -1,29 +1,20 @@
import 'package:aku_new_community/constants/saas_api.dart';
import 'package:aku_new_community/models/bracelet/bracelet_list_model.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
import 'package:aku_new_community/extensions/widget_list_ext.dart'; import 'package:aku_new_community/extensions/widget_list_ext.dart';
import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/pages/services/old_age/add_equipment_page.dart';
import 'package:aku_new_community/widget/bee_divider.dart'; import 'package:aku_new_community/widget/bee_divider.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart'; import 'package:aku_new_community/widget/bee_scaffold.dart';
class bracelet { import 'add_equipment_page.dart';
String title;
String describe;
bool open;
String path;
bracelet({
required this.title,
required this.describe,
required this.open,
required this.path,
});
}
class EquipmentListPage extends StatefulWidget { class EquipmentListPage extends StatefulWidget {
const EquipmentListPage({Key? key}) : super(key: key); const EquipmentListPage({Key? key}) : super(key: key);
@ -33,20 +24,8 @@ class EquipmentListPage extends StatefulWidget {
} }
class _EquipmentListPageState extends State<EquipmentListPage> { class _EquipmentListPageState extends State<EquipmentListPage> {
List<bracelet> _connects = [ BraceletListModel? _currentBracelet;
bracelet( List<BraceletListModel> _bracelets = [];
title: 'x5手环',
describe: '爱牵挂',
open: true,
path: Assets.bracelet.x5.path),
];
List<bracelet> _bracelets = [
bracelet(
title: 'x8手环 旗舰型',
describe: '爱牵挂',
open: false,
path: Assets.bracelet.x8.path),
];
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -82,49 +61,8 @@ class _EquipmentListPageState extends State<EquipmentListPage> {
.bold .bold
.make(), .make(),
24.w.heightBox, 24.w.heightBox,
..._connects if (_currentBracelet != null)
.map((e) => Container( _braceletWidget(e: _currentBracelet!, bgColor: Color(0xFF6395D7))
width: double.infinity,
padding: EdgeInsets.all(24.w),
decoration: BoxDecoration(
color: Color(0xFF6395D7),
borderRadius: BorderRadius.circular(16.w)),
child: Row(
children: [
Image.asset(
e.path,
width: 100.w,
height: 100.w,
),
12.w.widthBox,
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
'${e.title}'.text.size(24.sp).white.make(),
16.w.heightBox,
'${e.describe}'.text.size(24.sp).white.make(),
],
),
Spacer(),
Container(
width: 15.w,
height: 16.w,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16.w),
),
),
24.w.widthBox,
'${e.open ? '已连接' : '未开启'}'
.text
.size(24.sp)
.white
.make(),
],
),
))
.toList()
.sepWidget(separate: 24.w.heightBox),
], ],
), ),
); );
@ -141,55 +79,12 @@ class _EquipmentListPageState extends State<EquipmentListPage> {
.make(), .make(),
24.w.heightBox, 24.w.heightBox,
..._bracelets ..._bracelets
.map((e) => Container( .map((e) => _braceletWidget(
width: double.infinity, e: e,
padding: EdgeInsets.all(24.w), onTap: () {
decoration: BoxDecoration( _currentBracelet = e;
color: Colors.black.withOpacity(0.06), setState(() {});
borderRadius: BorderRadius.circular(16.w)), }))
child: Row(
children: [
Image.asset(
e.path,
width: 100.w,
height: 100.w,
),
12.w.widthBox,
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'${e.title}'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.65))
.make(),
16.w.heightBox,
'${e.describe}'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.65))
.make(),
],
),
Spacer(),
Container(
width: 15.w,
height: 16.w,
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.25),
borderRadius: BorderRadius.circular(16.w),
),
),
24.w.widthBox,
'${e.open ? '已连接' : '未开启'}'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.65))
.make(),
],
),
))
.toList() .toList()
.sepWidget( .sepWidget(
separate: 24.w.heightBox, separate: 24.w.heightBox,
@ -201,32 +96,103 @@ class _EquipmentListPageState extends State<EquipmentListPage> {
title: '设备列表', title: '设备列表',
bodyColor: Colors.white, bodyColor: Colors.white,
body: SafeArea( body: SafeArea(
child: EasyRefresh(
firstRefresh: true,
header: MaterialHeader(),
onRefresh: () async {
var base = await NetUtil().get(SAASAPI.bracelet.list);
if (base.success) {
_bracelets = (base.data as List)
.map((e) => BraceletListModel.fromJson(e))
.toList();
setState(() {});
}
},
child: ListView( child: ListView(
padding: EdgeInsets.all(24.w), padding: EdgeInsets.all(24.w),
children: [
// user,
// BeeDivider.horizontal(),
connected,
24.w.heightBox,
bingding,
BeeDivider.horizontal(),
// 24.w.heightBox,
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
TextButton( // user,
onPressed: () { // BeeDivider.horizontal(),
Get.to(() => AddEquipmentPage()); connected,
}, 24.w.heightBox,
child: '添加智能设备' bingding,
.text BeeDivider.horizontal(),
.size(28.sp) // 24.w.heightBox,
.color(Color(0xFF6395D7))
.make()),
], ],
) ),
], ),
)), ),
bottomNavi: Padding(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
child: MaterialButton(
onPressed: () {
Get.to(() => AddEquipmentPage());
},
color: Color(0xFF5096F1),
padding: EdgeInsets.symmetric(vertical: 24.w),
minWidth: 686.w,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.w),
),
child: '添加设备'.text.size(28.sp).white.make(),
),
),
);
}
Widget _braceletWidget(
{required BraceletListModel e, VoidCallback? onTap, Color? bgColor}) {
return GestureDetector(
onTap: onTap,
child: Container(
width: double.infinity,
padding: EdgeInsets.all(24.w),
decoration: BoxDecoration(
color: bgColor ?? Colors.black.withOpacity(0.06),
borderRadius: BorderRadius.circular(16.w)),
child: Row(
children: [
Image.asset(
e.braceletBrand.imgPath,
width: 100.w,
height: 100.w,
),
12.w.widthBox,
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'${e.deviceType} ${e.braceletBrand.name}'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.65))
.make(),
16.w.heightBox,
'设备码:${e.imei}'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.65))
.make(),
],
),
Spacer(),
Container(
width: 15.w,
height: 16.w,
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.25),
borderRadius: BorderRadius.circular(16.w),
),
),
24.w.widthBox,
'${UserTool.oldAgeProvider.imei == e.imei ? '已连接' : '未开启'}'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.65))
.make(),
],
),
),
); );
} }
} }

@ -1,16 +1,17 @@
import 'dart:async';
import 'package:aku_new_community/constants/saas_api.dart'; import 'package:aku_new_community/constants/saas_api.dart';
import 'package:aku_new_community/utils/network/base_model.dart'; import 'package:aku_new_community/utils/network/base_model.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:common_utils/common_utils.dart'; import 'package:common_utils/common_utils.dart';
import 'package:dio/dio.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart' hide Response; import 'package:get/get.dart' hide Response;
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/gen/assets.gen.dart'; import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/models/bracelet/bracelet_model.dart'; import 'package:aku_new_community/models/bracelet/bracelet_model.dart';
import 'package:aku_new_community/pages/services/old_age/add_equipment_page.dart'; import 'package:aku_new_community/pages/services/old_age/add_equipment_page.dart';
@ -31,17 +32,35 @@ class _OldAgeSupportPageSimpleState extends State<OldAgeSupportPageSimple> {
BraceletModel? _model; BraceletModel? _model;
DateTime? _date; DateTime? _date;
Timer? _timer;
void _startTimer() {
_timer = Timer.periodic(Duration(seconds: 5), (timer) {
_date = DateTime.now();
getData();
});
}
void _disposeTimer() {
_timer?.cancel();
_timer = null;
}
@override @override
void initState() { void initState() {
var cancel = BotToast.showLoading(); Future.delayed(Duration.zero, () async {
getData(); var cancel = BotToast.showLoading();
cancel(); await getData();
cancel();
_startTimer();
});
super.initState(); super.initState();
} }
@override @override
void dispose() { void dispose() {
BotToast.closeAllLoading(); BotToast.closeAllLoading();
_disposeTimer();
super.dispose(); super.dispose();
} }
@ -130,17 +149,14 @@ class _OldAgeSupportPageSimpleState extends State<OldAgeSupportPageSimple> {
} }
Future getData() async { Future getData() async {
var cancel = BotToast.showLoading(); BaseModel base = await NetUtil().get(SAASAPI.bracelet.data, params: {
BaseModel base = 'imei': UserTool.oldAgeProvider.imei,
await NetUtil().get(SAASAPI.bracelet.data, params: {
'imei': 863204050238280,
}); });
if (base.data != null) { if (base.data != null) {
_model = BraceletModel.fromJson(base.data); _model = BraceletModel.fromJson(base.data);
_date = DateTime.now(); _date = DateTime.now();
} }
setState(() {}); setState(() {});
cancel();
} }
Container bottomCard() { Container bottomCard() {
@ -441,7 +457,7 @@ class _OldAgeSupportPageSimpleState extends State<OldAgeSupportPageSimple> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
'剩余电量'.text.size(28.sp).color(Colors.black.withOpacity(0.65)).make(), '剩余电量'.text.size(28.sp).color(Colors.black.withOpacity(0.65)).make(),
'${_model?.remainingPower??0}' '${_model?.remainingPower ?? 0}'
.richText .richText
.withTextSpanChildren([ .withTextSpanChildren([
' %' ' %'
@ -547,6 +563,16 @@ class _OldAgeSupportPageSimpleState extends State<OldAgeSupportPageSimple> {
), ),
), ),
), ),
actions: [
IconButton(
icon: Icon(CupertinoIcons.repeat),
iconSize: 30.w,
color: Colors.black,
onPressed: () {
Get.to(() => EquipmentListPage());
},
)
],
bottomNavi: Padding( bottomNavi: Padding(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w), padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
child: MaterialButton( child: MaterialButton(

@ -0,0 +1,13 @@
enum BraceletBrand {
aqg(1, '爱牵挂','assets/bracelet/x5.png');
final int typeNum;
final String name;
final String imgPath;
static BraceletBrand getValue(int value) =>
BraceletBrand.values.firstWhere((element) => element.typeNum == value);
const BraceletBrand(this.typeNum, this.name,this.imgPath);
}

@ -1,7 +1,11 @@
import 'package:aku_new_community/constants/saas_api.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
import 'package:aku_new_community/gen/assets.gen.dart'; import 'package:aku_new_community/gen/assets.gen.dart';
@ -67,12 +71,25 @@ class _SubmitEquipmentCodePageState extends State<SubmitEquipmentCodePage> {
bottomNavi: Padding( bottomNavi: Padding(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w), padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w),
child: MaterialButton( child: MaterialButton(
onPressed: () { onPressed: () async {
if (_editingController.text.isEmpty) { if (_editingController.text.isEmpty) {
BotToast.showText(text: '设备码不能为空'); BotToast.showText(text: '设备码不能为空');
return; return;
} }
BotToast.showText(text: '请输入正确的设备码'); var base = await NetUtil().post(SAASAPI.bracelet.add, params: {
'type': 1,
'deviceType': 'x5',
'imei': _editingController.text
});
if (base.success) {
Get.back();
Get.back();
if (UserTool.oldAgeProvider.imei.isEmpty) {
UserTool.oldAgeProvider.changeImei(_editingController.text);
}
} else {
BotToast.showText(text: base.msg);
}
}, },
elevation: 0, elevation: 0,
color: Color(0xFF6395D7), color: Color(0xFF6395D7),

@ -0,0 +1,12 @@
import 'package:flutter/material.dart';
class OldAgeProvider extends ChangeNotifier {
String _imei='';
String get imei => _imei;
void changeImei(String value) {
_imei = value;
notifyListeners();
}
}

@ -96,9 +96,6 @@ class _AdviceDetailPageState extends State<AdviceDetailPage> {
type = ''; type = '';
break; break;
case 2: case 2:
type = '装修公司';
break;
case 3:
type = '物业'; type = '物业';
break; break;
} }

@ -1,4 +1,5 @@
import 'package:aku_new_community/constants/app_theme.dart'; import 'package:aku_new_community/constants/app_theme.dart';
import 'package:aku_new_community/provider/old_age_provider.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -20,5 +21,8 @@ class UserTool {
static MyAppStyle get myAppStyle => static MyAppStyle get myAppStyle =>
Theme.of(Get.context!).extension<MyAppStyle>()!; Theme.of(Get.context!).extension<MyAppStyle>()!;
static OldAgeProvider get oldAgeProvider =>
Provider.of<OldAgeProvider>(Get.context!, listen: false);
UserTool(); UserTool();
} }

Loading…
Cancel
Save