From 07e765a52124edc298c7e27d2f57f64b764a7c63 Mon Sep 17 00:00:00 2001 From: wylyl22 <2373073266@qq.com> Date: Tue, 13 Sep 2022 17:19:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/model/exclude_phone_model.dart | 6 ++-- lib/model/exclude_phone_model.g.dart | 10 +++++-- lib/ui/home/set/specify_phone_page.dart | 40 ++++++++++++------------- 3 files changed, 31 insertions(+), 25 deletions(-) diff --git a/lib/model/exclude_phone_model.dart b/lib/model/exclude_phone_model.dart index 6658eeb..ebea5cc 100644 --- a/lib/model/exclude_phone_model.dart +++ b/lib/model/exclude_phone_model.dart @@ -8,15 +8,17 @@ class ExcludePhoneModel extends Equatable{ final int id; final String phone; final String remark; - factory ExcludePhoneModel.fromJson(Map json) =>_$ExcludePhoneModelFromJson(json); + final String address; + factory ExcludePhoneModel.fromJson(Map json) =>_$ExcludePhoneModelFromJson(json); Map toJson()=> _$ExcludePhoneModelToJson(this); const ExcludePhoneModel({ required this.id, required this.phone, required this.remark, + required this.address, }); @override - List get props => [id,phone,remark]; + List get props => [id,phone,remark,address]; } \ No newline at end of file diff --git a/lib/model/exclude_phone_model.g.dart b/lib/model/exclude_phone_model.g.dart index 745bc36..16e8d94 100644 --- a/lib/model/exclude_phone_model.g.dart +++ b/lib/model/exclude_phone_model.g.dart @@ -6,14 +6,18 @@ part of 'exclude_phone_model.dart'; // JsonSerializableGenerator // ************************************************************************** -ExcludePhoneModel _$ExcludePhoneModelFromJson(Map json) => ExcludePhoneModel( +ExcludePhoneModel _$ExcludePhoneModelFromJson(Map json) => + ExcludePhoneModel( id: json['id'] as int, phone: json['phone'] as String, remark: json['remark'] as String, + address: json['address'] as String, ); -Map _$ExcludePhoneModelToJson(ExcludePhoneModel instance) => { +Map _$ExcludePhoneModelToJson(ExcludePhoneModel instance) => + { 'id': instance.id, 'phone': instance.phone, 'remark': instance.remark, - }; \ No newline at end of file + 'address': instance.address, + }; diff --git a/lib/ui/home/set/specify_phone_page.dart b/lib/ui/home/set/specify_phone_page.dart index 8f903b7..f3ac118 100644 --- a/lib/ui/home/set/specify_phone_page.dart +++ b/lib/ui/home/set/specify_phone_page.dart @@ -1,4 +1,3 @@ - import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; @@ -15,7 +14,6 @@ import '../../../base/base_style.dart'; import '../../../model/exclude_phone_model.dart'; - import '../../widget/scaffold_theme_widget.dart'; import 'func/exclude_contacts_func.dart'; @@ -28,9 +26,7 @@ class SpecifyPhonePage extends StatefulWidget { class _SpecifyPhonePageState extends State { final EasyRefreshController _refreshController = EasyRefreshController(); - List findList = [ - - ]; + List findList = []; @override void dispose() { @@ -73,21 +69,23 @@ class _SpecifyPhonePageState extends State { // Get.to(() => const CallRecordsList()); }), _getAddPhone("通迅录添加", "通过本机通讯录添加号码", () async { - if(await Permission.contacts.isDenied){ + if (await Permission.contacts.isDenied) { showDialog( context: context, builder: (context) { return AlertDialog( content: const Text('获取通讯录权限还未开启'), actions: [ - ElevatedButton(onPressed: (){ - openAppSettings(); - }, - child: const Text("前往开启"),), + ElevatedButton( + onPressed: () { + openAppSettings(); + }, + child: const Text("前往开启"), + ), ], ); }); - }else{ + } else { Get.to(() => (const ExcludeContactsPage())); } }), @@ -133,7 +131,6 @@ class _SpecifyPhonePageState extends State { ), ); - } _getNum() { @@ -173,7 +170,8 @@ class _SpecifyPhonePageState extends State { ), 24.hb, CupertinoTextField( - padding: EdgeInsets.symmetric(horizontal: 24.w,vertical: 20.w), + padding: EdgeInsets.symmetric( + horizontal: 24.w, vertical: 20.w), decoration: BoxDecoration( border: Border.all(color: Colors.white), // borderRadius: BorderRadius.all( @@ -195,7 +193,8 @@ class _SpecifyPhonePageState extends State { ), 24.hb, CupertinoTextField( - padding: EdgeInsets.symmetric(horizontal: 24.w,vertical: 20.w), + padding: EdgeInsets.symmetric( + horizontal: 24.w, vertical: 20.w), decoration: BoxDecoration( border: Border.all(color: Colors.white), // borderRadius: BorderRadius.all( @@ -208,10 +207,10 @@ class _SpecifyPhonePageState extends State { 82.hb, // _getUpdate("爸爸", "123123123"), PloneBottom( - blM:false, + blM: false, border: true, - color1:const Color(0xFF1890FF), - color2:const Color(0xFF74BCFF), + color1: const Color(0xFF1890FF), + color2: const Color(0xFF74BCFF), onTap: () {}, text: "保存", ) @@ -222,13 +221,15 @@ class _SpecifyPhonePageState extends State { ); }); }, - title: Text(item.phone, + title: Text( + + item.phone, style: TextStyle( fontSize: 32.sp, color: BaseStyle.color333333, fontWeight: FontWeight.bold)), subtitle: Text( - item.remark, + item.address, style: TextStyle(fontSize: 28.sp, color: BaseStyle.color999999), ), trailing: TextButton( @@ -254,7 +255,6 @@ class _SpecifyPhonePageState extends State { ); } - _getAddPhone(String title, String text, VoidCallback widget) { return GestureDetector( onTap: widget,