帮助反馈ui 和登录流程 新增dio网络请求和sp存储
This commit is contained in:
parent
2312ab7084
commit
238c729eee
@ -47,7 +47,7 @@ android {
|
||||
applicationId "com.example.circle_app"
|
||||
// You can update the following values to match your application needs.
|
||||
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
||||
minSdkVersion flutter.minSdkVersion
|
||||
minSdkVersion 19
|
||||
targetSdkVersion flutter.targetSdkVersion
|
||||
versionCode flutterVersionCode.toInteger()
|
||||
versionName flutterVersionName
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.circle_app">
|
||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<application
|
||||
android:label="circle_app"
|
||||
android:name="${applicationName}"
|
||||
@ -12,6 +13,8 @@
|
||||
android:theme="@style/LaunchTheme"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
android:hardwareAccelerated="true"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<!-- Specifies an Android theme to apply to this Activity as soon as
|
||||
the Android process has started. This theme is visible to the user
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<network-security-config>
|
||||
<base-config cleartextTrafficPermitted="true" />
|
||||
</network-security-config>
|
||||
@ -3,6 +3,10 @@ buildscript {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
maven{url 'https://maven.aliyun.com/repository/google' }
|
||||
maven{url 'https://maven.aliyun.com/repository/google-plugin' }
|
||||
maven{url 'https://maven.aliyun.com/repository/public' }
|
||||
maven{url 'https://maven.aliyun.com/repository/jcenter' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
BIN
circle_app/assets/images/mine/im_down.png
Normal file
BIN
circle_app/assets/images/mine/im_down.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 268 B |
@ -13,152 +13,177 @@ class AboutappPage extends StatelessWidget {
|
||||
AboutappPage({Key? key}) : super(key: key);
|
||||
|
||||
final logic = Get.find<AboutappLogic>();
|
||||
final state = Get.find<AboutappLogic>().state;
|
||||
|
||||
final state = Get
|
||||
.find<AboutappLogic>()
|
||||
.state;
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(getBaseImage("home_back")),
|
||||
fit: BoxFit.cover,
|
||||
return GetBuilder<AboutappLogic>(builder: (logic) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(getBaseImage("home_back")),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: MyAppBar(centerTitle: '关于',),
|
||||
body: Scaffold(
|
||||
backgroundColor: Colors.transparent, // Replace with your desired color
|
||||
body: Container(
|
||||
margin: EdgeInsets.only(left: 11.sp,right: 11.sp),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: MyAppBar(centerTitle: '关于圈子',),
|
||||
body: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
// Replace with your desired color
|
||||
body: Container(
|
||||
margin: EdgeInsets.only(left: 11.sp, right: 11.sp),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
|
||||
children: [
|
||||
// Image.asset(
|
||||
// getHomeImage("mine_circle"), // Replace with your image path
|
||||
// width: double.infinity,
|
||||
// height: double.infinity,
|
||||
// fit: BoxFit.contain,
|
||||
// ),
|
||||
SizedBox(height: 20),
|
||||
Text(
|
||||
'圈子',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFF7FAFA),
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 40),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 0.4,
|
||||
color: Color(0xFF2E2E3B),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
_openBrowser();
|
||||
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
// Image.asset(
|
||||
// getHomeImage("mine_circle"), // Replace with your image path
|
||||
// width: double.infinity,
|
||||
// height: double.infinity,
|
||||
// fit: BoxFit.contain,
|
||||
// ),
|
||||
SizedBox(height: 20.sp),
|
||||
Text(
|
||||
'评价跨友',
|
||||
'圈子',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFF7FAFA),
|
||||
fontSize: 16,
|
||||
fontSize: 16.sp,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
|
||||
SizedBox(width: 8),
|
||||
Image(
|
||||
image: AssetImage(getHomeImage("icon_in")),width: 24.sp,height: 24.sp,
|
||||
fit: BoxFit.fill,
|
||||
SizedBox(height: 40.sp),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 0.4.sp,
|
||||
color: Color(0xFF2E2E3B),
|
||||
),
|
||||
// SizedBox(height: 20),
|
||||
// GestureDetector(
|
||||
// behavior: HitTestBehavior.opaque,
|
||||
// onTap: () {
|
||||
// _openBrowser();
|
||||
// },
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Text(
|
||||
// '评价圈子',
|
||||
// style: TextStyle(
|
||||
// color: Color(0xFFF7FAFA),
|
||||
// fontSize: 16,
|
||||
// ),
|
||||
// ),
|
||||
// Spacer(),
|
||||
//
|
||||
// SizedBox(width: 8),
|
||||
// Image(
|
||||
// image: AssetImage(getHomeImage("icon_in")),
|
||||
// width: 24.sp,
|
||||
// height: 24.sp,
|
||||
// fit: BoxFit.fill,
|
||||
// ),
|
||||
//
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
|
||||
SizedBox(height: 20.sp),
|
||||
GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: (){
|
||||
Get.toNamed(AppRoutes.WebViewActivity,arguments: {'title':"用户协议","url":"https://www.baidu.com"});
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'用户协议',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFF7FAFA),
|
||||
fontSize: 16.sp,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Image(
|
||||
image: AssetImage(getHomeImage("icon_in")),
|
||||
width: 24.sp,
|
||||
height: 24.sp,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
],
|
||||
),),
|
||||
SizedBox(height: 20.sp),
|
||||
GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: (){
|
||||
Get.toNamed(AppRoutes.WebViewActivity,arguments: {'title':"隐私协议","url":"https://www.baidu.com"});
|
||||
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'隐私政策',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFF7FAFA),
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Image(
|
||||
image: AssetImage(getHomeImage("icon_in")),
|
||||
width: 24.sp,
|
||||
height: 24.sp,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
],
|
||||
),)
|
||||
,
|
||||
SizedBox(height: 20.sp),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
'版本更新',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFF7FAFA),
|
||||
fontSize: 16.sp,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Container(
|
||||
width: 6.sp,
|
||||
height: 5.sp,
|
||||
margin: EdgeInsets.only(top: 1.sp, right: 8.sp),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red,
|
||||
borderRadius: BorderRadius.circular(3.sp),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'1.0.0',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFB7BECC),
|
||||
fontSize: 12.sp,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Image(
|
||||
image: AssetImage(getHomeImage("icon_in")),
|
||||
width: 24.sp,
|
||||
height: 24.sp,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 20),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
'用户协议',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFF7FAFA),
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Image(
|
||||
image: AssetImage(getHomeImage("icon_in")),width: 24.sp,height: 24.sp,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
'隐私政策',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFF7FAFA),
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Image(
|
||||
image: AssetImage(getHomeImage("icon_in")),width: 24.sp,height: 24.sp,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
'版本更新',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFF7FAFA),
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Container(
|
||||
width: 6,
|
||||
height: 5,
|
||||
margin: EdgeInsets.only(top: 1, right: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red,
|
||||
borderRadius: BorderRadius.circular(3),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'1.0.0',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFB7BECC),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Image(
|
||||
image: AssetImage(getHomeImage("icon_in")),width: 24.sp,height: 24.sp,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),)
|
||||
),),
|
||||
);
|
||||
),)
|
||||
),),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
String url = 'https://www.baidu.com'; // Replace with your desired URL
|
||||
|
||||
void _openBrowser() async {
|
||||
|
||||
@ -31,7 +31,7 @@ class AccountPage extends StatelessWidget {
|
||||
backgroundColor: Colors.transparent,
|
||||
body: SafeArea(
|
||||
child: ListView(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
padding: EdgeInsets.all(16.0.sp),
|
||||
children: [
|
||||
// Container(
|
||||
// margin: EdgeInsets.only(top: 16.0),
|
||||
@ -58,14 +58,14 @@ class AccountPage extends StatelessWidget {
|
||||
Get.toNamed(AppRoutes.PhotoActivity);
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 16.0),
|
||||
margin: EdgeInsets.only(top: 16.0.sp),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
"换绑手机号",
|
||||
style: TextStyle(
|
||||
color: Color(0xFFF7FAFA),
|
||||
fontSize: 16.0,
|
||||
fontSize: 16.0.sp,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
@ -73,14 +73,14 @@ class AccountPage extends StatelessWidget {
|
||||
"16677778888",
|
||||
style: TextStyle(
|
||||
color: Color(0xFFB7BECC),
|
||||
fontSize: 16.0,
|
||||
fontSize: 16.0.sp,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8.0),
|
||||
SizedBox(width: 8.0.sp),
|
||||
Image.asset(
|
||||
getHomeImage("icon_in"),
|
||||
width: 24.0,
|
||||
height: 24.0,
|
||||
width: 24.0.sp,
|
||||
height: 24.0.sp,
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -112,21 +112,21 @@ class AccountPage extends StatelessWidget {
|
||||
Get.toNamed(AppRoutes.OffAccountActivity);
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 16.0),
|
||||
margin: EdgeInsets.only(top: 16.0.sp),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
"注销账号",
|
||||
style: TextStyle(
|
||||
color: Color(0xFFF7FAFA),
|
||||
fontSize: 16.0,
|
||||
fontSize: 16.0.sp,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Image.asset(
|
||||
getHomeImage("icon_in"),
|
||||
width: 24.0,
|
||||
height: 24.0,
|
||||
width: 24.0.sp,
|
||||
height: 24.0.sp,
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -263,7 +263,7 @@ class AccountPage extends StatelessWidget {
|
||||
Container(
|
||||
margin: EdgeInsets.only(
|
||||
top: 40.0.sp, left: 72.0.sp, right: 72.0.sp),
|
||||
height: 42,
|
||||
height: 42.sp,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(21.0.sp),
|
||||
color: Color(0xFF21BEAB),
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../components/my_app_bar.dart';
|
||||
@ -29,7 +30,7 @@ class BlacklistPage extends StatelessWidget {
|
||||
child: SmartRefresher(
|
||||
controller: _refreshController,
|
||||
child: ListView.builder(
|
||||
padding: EdgeInsets.all(16),
|
||||
padding: EdgeInsets.all(16.sp),
|
||||
itemCount: itemCount,
|
||||
itemBuilder: (context, index) {
|
||||
return ListTile(
|
||||
|
||||
@ -219,8 +219,8 @@ class CirclePage extends StatelessWidget {
|
||||
children: [
|
||||
Container(
|
||||
height: 30.sp,
|
||||
width: 30.0 +
|
||||
15 * (widgets.length - 1),
|
||||
width: 30.0.sp +
|
||||
15.sp * (widgets.length - 1.sp),
|
||||
child: Stack(
|
||||
children: widgets,
|
||||
),
|
||||
|
||||
@ -2,4 +2,5 @@ class FeedbackState {
|
||||
FeedbackState() {
|
||||
///Initialize variables
|
||||
}
|
||||
String maxMsg = "0/200";
|
||||
}
|
||||
|
||||
@ -11,13 +11,11 @@ class FeedbackPage extends StatelessWidget {
|
||||
FeedbackPage({Key? key}) : super(key: key);
|
||||
|
||||
final logic = Get.find<FeedbackLogic>();
|
||||
final state = Get
|
||||
.find<FeedbackLogic>()
|
||||
.state;
|
||||
final state = Get.find<FeedbackLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder(builder: (FeedbackLogic controller){
|
||||
return GetBuilder(builder: (FeedbackLogic controller) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
@ -26,106 +24,126 @@ class FeedbackPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: MyAppBar(
|
||||
centerTitle: '意见反馈',
|
||||
),
|
||||
body: SingleChildScrollView(child: SafeArea(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
height: 200,
|
||||
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 20),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(13),
|
||||
color: Color(
|
||||
0xFF4C3E5F), // Use your desired background color
|
||||
),
|
||||
padding: EdgeInsets.all(13),
|
||||
child: TextField(
|
||||
decoration: InputDecoration(
|
||||
hintText: '请补充详细问题和意见,我们会认真看完的哦~',
|
||||
hintStyle: TextStyle(
|
||||
color: Color(0xFFB7BECC), fontSize: 14.sp),
|
||||
border: InputBorder.none,
|
||||
|
||||
),
|
||||
maxLines: null,
|
||||
maxLength: 200,
|
||||
|
||||
inputFormatters: [
|
||||
LengthLimitingTextInputFormatter(200),
|
||||
],
|
||||
style: TextStyle(color: Colors.white),
|
||||
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 120.sp,
|
||||
margin: EdgeInsets.only(left: 16.sp,right: 16.sp),
|
||||
child: GridView.builder(
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 3, // 每行显示的项目数量
|
||||
),
|
||||
itemCount: 4, // Replace with your item count
|
||||
itemBuilder: (context, index) {
|
||||
if (index == 0) {
|
||||
// 第一个项目,显示固定的图片
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
controller.getImageFile();
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(5.sp),
|
||||
child: Image(
|
||||
image: AssetImage(getMineImage("icon_img_add")),
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
// 后续项目,根据接口获取数据
|
||||
// 假设通过接口获取到的数据存储在一个名为 data 的列表中
|
||||
// var itemData = data[index - 1]; // 减去第一个固定图片的索引
|
||||
return Container(
|
||||
margin: EdgeInsets.all(5.sp),
|
||||
child: Center(
|
||||
// child: _buildImageItem(
|
||||
// 'https://book.flutterchina.club/assets/img/logo.png'),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 16, top: 10),
|
||||
child: Text(
|
||||
'最多选择3张图片',
|
||||
style: TextStyle(color: Color(0xFFB7BECC), fontSize: 12),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 50),
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 72),
|
||||
height: 42,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(21),
|
||||
color: Color(0xFF21BEAB),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'提交',
|
||||
style: TextStyle(color: Colors.white, fontSize: 16),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: MyAppBar(
|
||||
centerTitle: '意见反馈',
|
||||
),
|
||||
),)
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Stack(
|
||||
children: [
|
||||
Container(
|
||||
height: 200,
|
||||
margin: EdgeInsets.symmetric(
|
||||
horizontal: 16, vertical: 20),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(13),
|
||||
color: Color(
|
||||
0xFF4C3E5F), // Use your desired background color
|
||||
),
|
||||
padding: EdgeInsets.all(13),
|
||||
child: TextField(
|
||||
maxLength: 200,
|
||||
|
||||
onChanged: (msg){
|
||||
print(msg);
|
||||
controller.state.maxMsg = '${msg.length}/200';
|
||||
controller.update();
|
||||
|
||||
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
hintText: '请补充详细问题和意见,我们会认真看完的哦~',
|
||||
counterText: '',
|
||||
hintStyle: TextStyle(
|
||||
color: Color(0xFFB7BECC), fontSize: 14.sp),
|
||||
border: InputBorder.none,
|
||||
),
|
||||
maxLines: null,
|
||||
inputFormatters: [
|
||||
LengthLimitingTextInputFormatter(200),
|
||||
],
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
right: 30.sp,
|
||||
bottom: 30.sp,
|
||||
child: Text(
|
||||
controller.state.maxMsg,
|
||||
style: TextStyle(color: Colors.white),
|
||||
))
|
||||
],
|
||||
),
|
||||
Container(
|
||||
height: 120.sp,
|
||||
margin: EdgeInsets.only(left: 16.sp, right: 16.sp),
|
||||
child: GridView.builder(
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 3, // 每行显示的项目数量
|
||||
),
|
||||
itemCount: 4, // Replace with your item count
|
||||
itemBuilder: (context, index) {
|
||||
if (index == 0) {
|
||||
// 第一个项目,显示固定的图片
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
controller.getImageFile();
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(5.sp),
|
||||
child: Image(
|
||||
image:
|
||||
AssetImage(getMineImage("icon_img_add")),
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
// 后续项目,根据接口获取数据
|
||||
// 假设通过接口获取到的数据存储在一个名为 data 的列表中
|
||||
// var itemData = data[index - 1]; // 减去第一个固定图片的索引
|
||||
return Container(
|
||||
margin: EdgeInsets.all(5.sp),
|
||||
child: Center(
|
||||
// child: _buildImageItem(
|
||||
// 'https://book.flutterchina.club/assets/img/logo.png'),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 16, top: 10),
|
||||
child: Text(
|
||||
'最多选择3张图片',
|
||||
style:
|
||||
TextStyle(color: Color(0xFFB7BECC), fontSize: 12),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 50),
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 72),
|
||||
height: 42,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(21),
|
||||
color: Color(0xFF21BEAB),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'提交',
|
||||
style: TextStyle(color: Colors.white, fontSize: 16),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||
|
||||
@ -30,7 +31,7 @@ class FriendslistPage extends StatelessWidget {
|
||||
child: SmartRefresher(
|
||||
controller: _refreshController,
|
||||
child: ListView.builder(
|
||||
padding: EdgeInsets.all(16),
|
||||
padding: EdgeInsets.all(16.sp),
|
||||
itemCount: itemCount,
|
||||
itemBuilder: (context, index) {
|
||||
return ListTile(
|
||||
|
||||
@ -4,4 +4,40 @@ import 'state.dart';
|
||||
|
||||
class HelpLogic extends GetxController {
|
||||
final HelpState state = HelpState();
|
||||
|
||||
List<FaqItem> msgList = [
|
||||
FaqItem(
|
||||
question: '·为什么我被禁言了?',
|
||||
answer: '答:我们审核人员24小时巡查的,存在发布违规内容、骂人、发QQ微信、欺诈骗取财物、打广告等违规行为都会被禁言或永久封禁!',
|
||||
),
|
||||
FaqItem(
|
||||
question: '·可以免费领取会员吗?',
|
||||
answer: '答:可以的,邀请一些圈友加入我们,就可以免费获得会员哦~',
|
||||
),
|
||||
FaqItem(
|
||||
question: '·如何让更多的人看到我?',
|
||||
answer: '答:开通会员提升权重、多加入一些圈子、多在这些圈子里喊话、多找一些圈友聊天。',
|
||||
),
|
||||
FaqItem(
|
||||
question: '·怎样做才能获更多人的喜欢?',
|
||||
answer: '答:完善个人资料丰富形象、多上传一些形象照、及时回复圈友发来的消息、真诚文明地聊天。',
|
||||
),
|
||||
FaqItem(
|
||||
question: '·发现图片或视频被人盗取了怎么办?',
|
||||
answer: '答:立即举报,并向在线客户反应情况。\n 划重点:核实后会对其做出处理并要求删除相关内容~',
|
||||
),
|
||||
// 添加更多的问题和答案
|
||||
];
|
||||
|
||||
}
|
||||
class FaqItem {
|
||||
String question;
|
||||
String answer;
|
||||
bool selected;
|
||||
|
||||
FaqItem({
|
||||
required this.question,
|
||||
required this.answer,
|
||||
this.selected = false,
|
||||
});
|
||||
}
|
||||
@ -1,3 +1,4 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -12,153 +13,217 @@ class HelpPage extends StatelessWidget {
|
||||
|
||||
final logic = Get.find<HelpLogic>();
|
||||
final state = Get.find<HelpLogic>().state;
|
||||
bool showAnswer = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(getBaseImage("home_back")),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: MyAppBar(
|
||||
centerTitle: '帮助与反馈',
|
||||
),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 30.sp),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'04-10 19:51',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFB7BECC),
|
||||
fontSize: 12.sp,
|
||||
return GetBuilder<HelpLogic>(builder: (logic) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(getBaseImage("home_back")),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: MyAppBar(
|
||||
centerTitle: '帮助与反馈',
|
||||
),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 30.sp),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'04-10 19:51',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFB7BECC),
|
||||
fontSize: 12.sp,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16.sp),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 16.sp, right: 16.sp),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
height: 200.sp,
|
||||
child: Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: Image.asset(
|
||||
getMineImage("im_feedback"),
|
||||
width: 32.sp,
|
||||
height: 32.sp,
|
||||
SizedBox(height: 16.sp),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 16.sp, right: 16.sp),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
height: 300.sp,
|
||||
child: Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: Image.asset(
|
||||
getMineImage("im_feedback"),
|
||||
width: 32.sp,
|
||||
height: 32.sp,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8.sp),
|
||||
Expanded(
|
||||
child: Container(
|
||||
height: 200,
|
||||
padding: EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(4.sp),
|
||||
color: Color(0xFF2E2E3B),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'猜你想问',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFB7BECC),
|
||||
fontSize: 14.sp,
|
||||
),
|
||||
SizedBox(width: 8.sp),
|
||||
Expanded(
|
||||
child: Container(
|
||||
height: 300,
|
||||
padding: EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(4.sp),
|
||||
color: Color(0xFF2E2E3B),
|
||||
),
|
||||
child: Center(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'猜你想问',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFB7BECC),
|
||||
fontSize: 14.sp,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10.sp),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: logic.msgList.length,
|
||||
itemBuilder: (context, index) {
|
||||
return Column(
|
||||
children: [
|
||||
GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
showAnswer =
|
||||
!showAnswer; // 切换显示答案的状态
|
||||
for (int i = 0;
|
||||
i < logic.msgList.length;
|
||||
i++) {
|
||||
if (index == i) {
|
||||
logic.msgList[i].selected =
|
||||
true;
|
||||
} else {
|
||||
logic.msgList[i].selected =
|
||||
false;
|
||||
}
|
||||
}
|
||||
|
||||
// logic.msgList[index].selected = true;
|
||||
logic.update();
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(
|
||||
top: 10.sp, bottom: 10.sp),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
logic.msgList[index].question,
|
||||
style: TextStyle(
|
||||
color: Colors.white),
|
||||
),
|
||||
Image(
|
||||
image: AssetImage(logic.msgList[index].selected ?
|
||||
getMineImage("im_down") :
|
||||
getMineImage("im_right")),
|
||||
width: 10.sp,
|
||||
height: 14.sp,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
if (logic.msgList[index]
|
||||
.selected) // 只有当showAnswer为true且当前索引与选中索引匹配时才显示答案
|
||||
Container(
|
||||
margin: EdgeInsets.all(6.sp),
|
||||
child: Text(
|
||||
textAlign: TextAlign.left,
|
||||
logic.msgList[index].answer,
|
||||
style: TextStyle(
|
||||
color: Colors.white70,
|
||||
fontSize: 12.sp),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10.sp),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: /* Replace with your item count */ 0,
|
||||
itemBuilder: (context, index) {
|
||||
return /* Replace with your list item widget */;
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(bottom: 30.sp),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
TextButton.icon(
|
||||
onPressed: () {
|
||||
Get.toNamed(AppRoutes.FeedbackActivity);
|
||||
// Handle feedback button press
|
||||
},
|
||||
icon: Image.asset(
|
||||
getMineImage("im_feedback_write"),
|
||||
width: 14.sp,
|
||||
height: 14.sp,
|
||||
),
|
||||
label: Text(
|
||||
'意见反馈',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14,
|
||||
Spacer(),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(bottom: 30.sp),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
TextButton.icon(
|
||||
onPressed: () {
|
||||
Get.toNamed(AppRoutes.FeedbackActivity);
|
||||
// Handle feedback button press
|
||||
},
|
||||
icon: Image.asset(
|
||||
getMineImage("im_feedback_write"),
|
||||
width: 14.sp,
|
||||
height: 14.sp,
|
||||
),
|
||||
label: Text(
|
||||
'意见反馈',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
style: TextButton.styleFrom(
|
||||
backgroundColor: Color(0xFF21BEAB),
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 16.sp, vertical: 4.sp),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20.sp),
|
||||
),
|
||||
),
|
||||
),
|
||||
style: TextButton.styleFrom(
|
||||
backgroundColor: Color(0xFF21BEAB),
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 16.sp, vertical: 4.sp),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20.sp),
|
||||
SizedBox(width: 20.sp),
|
||||
TextButton.icon(
|
||||
onPressed: () {
|
||||
// Handle contact service button press
|
||||
},
|
||||
icon: Image.asset(
|
||||
getMineImage("im_service"),
|
||||
width: 14.sp,
|
||||
height: 14.sp,
|
||||
),
|
||||
label: Text(
|
||||
'联系客服',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14.sp,
|
||||
),
|
||||
),
|
||||
style: TextButton.styleFrom(
|
||||
backgroundColor: Color(0xFF21BEAB),
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 16.sp, vertical: 4.sp),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20.sp),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 20),
|
||||
TextButton.icon(
|
||||
onPressed: () {
|
||||
// Handle contact service button press
|
||||
},
|
||||
icon: Image.asset(
|
||||
getMineImage("im_service"),
|
||||
width: 14.sp,
|
||||
height: 14.sp,
|
||||
),
|
||||
label: Text(
|
||||
'联系客服',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14.sp,
|
||||
),
|
||||
),
|
||||
style: TextButton.styleFrom(
|
||||
backgroundColor: Color(0xFF21BEAB),
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 16.sp, vertical: 4.sp),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20.sp),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,14 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:circle_app/router/app_routers.dart';
|
||||
import 'package:circle_app/util/util.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../../../network/network.dart';
|
||||
import 'state.dart';
|
||||
|
||||
class LoginLogic extends GetxController {
|
||||
@ -19,6 +23,7 @@ class LoginLogic extends GetxController {
|
||||
//倒计时
|
||||
starDownTimer() {
|
||||
if (sendCodeBtn == false && seconds == 60) {
|
||||
getCode();
|
||||
sendCodeBtn = true;
|
||||
t = Timer.periodic(Duration(milliseconds: 1000), (timer) {
|
||||
seconds--;
|
||||
@ -31,16 +36,67 @@ class LoginLogic extends GetxController {
|
||||
});
|
||||
}
|
||||
}
|
||||
Future<void> getCode() async {
|
||||
try{
|
||||
// var formData = Dio().options.contentType = 'application/x-www-form-urlencoded';
|
||||
// formData = {"phone": phoneEditingController.text} as String;
|
||||
|
||||
var response = await dio.post('msg-service/sms/code/send', queryParameters: {"phone": phoneEditingController.text});
|
||||
}catch(e){
|
||||
if (e is DioException) {
|
||||
print('DioException: ${e.message}');
|
||||
print('DioException Error: ${e.error}');
|
||||
print('DioException Response: ${e.response}');
|
||||
} else {
|
||||
print('Exception: $e');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@override
|
||||
void dispose() {
|
||||
// TODO: implement dispose
|
||||
super.dispose();
|
||||
t?.cancel();
|
||||
}
|
||||
|
||||
void login() {
|
||||
Get.toNamed(AppRoutes.Complete_materialPage);
|
||||
void login() async {
|
||||
if (!GetUtils.isPhoneNumber(phoneEditingController.text)) {
|
||||
showToast('请输入正确的手机号');
|
||||
}
|
||||
if (codeEditingController.text == '') {
|
||||
showToast('请输入验证码');
|
||||
}
|
||||
|
||||
try{
|
||||
var response = await dio.post('user-service/login/smscode', data: {"phone": phoneEditingController.text,"code":codeEditingController.text});
|
||||
Map<String, dynamic> jsonData = jsonDecode(response.data.toString());
|
||||
int code = jsonData['code'];
|
||||
String msg = jsonData['msg'];
|
||||
|
||||
String authorization = jsonData['data']['Authorization'];
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
prefs.setString('Authorization', authorization);
|
||||
|
||||
if(code == 200){
|
||||
Get.toNamed(AppRoutes.Home);
|
||||
return;
|
||||
}else if(code == 30002){
|
||||
Get.toNamed(AppRoutes.Complete_materialPage);
|
||||
return;
|
||||
}
|
||||
showToast(msg);
|
||||
}catch(e){
|
||||
if (e is DioException) {
|
||||
print('DioException: ${e.message}');
|
||||
print('DioException Error: ${e.error}');
|
||||
print('DioException Response: ${e.response}');
|
||||
} else {
|
||||
print('Exception: $e');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Get.toNamed(AppRoutes.Complete_materialPage);
|
||||
// if (!GetUtils.isPhoneNumber(phoneEditingController.text)) {
|
||||
// showToast('请输入正确的手机号');
|
||||
// }
|
||||
|
||||
@ -12,6 +12,7 @@ class LoginPage extends StatelessWidget {
|
||||
final state = Get
|
||||
.find<LoginLogic>()
|
||||
.state;
|
||||
bool isPhoto = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -53,6 +54,14 @@ class LoginPage extends StatelessWidget {
|
||||
Container(
|
||||
width: 200.sp,
|
||||
child: TextField(
|
||||
onChanged: (msg){
|
||||
if (GetUtils.isPhoneNumber(msg)&& msg.length==11) {
|
||||
isPhoto = true;
|
||||
}else{
|
||||
isPhoto = false;
|
||||
}
|
||||
logic.update();
|
||||
},
|
||||
controller: logic.phoneEditingController,
|
||||
maxLength: 11,
|
||||
style: TextStyle(
|
||||
@ -114,14 +123,16 @@ class LoginPage extends StatelessWidget {
|
||||
right: 0,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
logic.starDownTimer();
|
||||
if(isPhoto){
|
||||
logic.starDownTimer();
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
width: 76.sp,
|
||||
height: 29.sp,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white30,
|
||||
color:isPhoto ? Color(0xFF21BEAB) : Colors.white30,
|
||||
borderRadius: BorderRadius.circular(
|
||||
29.sp / 2)
|
||||
),
|
||||
|
||||
@ -1,11 +1,18 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../network/network.dart';
|
||||
import '../../router/app_routers.dart';
|
||||
import 'state.dart';
|
||||
|
||||
class MinefragmentLogic extends GetxController {
|
||||
final MinefragmentState state = MinefragmentState();
|
||||
jumpSetUp(){
|
||||
|
||||
|
||||
|
||||
jumpSetUp() {
|
||||
Get.toNamed(AppRoutes.SetUpActivity);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,7 +1,27 @@
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
import '../../network/network.dart';
|
||||
|
||||
class MinefragmentState {
|
||||
var hearUrl = "http://pics5.baidu.com/feed/622762d0f703918f751ba5e950ce8d915beec4c1.jpeg?token=ed435fd18c71cf7ca7a011acb70460f7";
|
||||
MinefragmentState() {
|
||||
request();
|
||||
///Initialize variables
|
||||
}
|
||||
Future<void> request() async {
|
||||
print("111111");
|
||||
try{
|
||||
var response = await dio.put('user-service/register/user/info', data: {});
|
||||
print(response.data.toString());
|
||||
}catch(e){
|
||||
if (e is DioException) {
|
||||
print('DioException: ${e.message}');
|
||||
print('DioException Error: ${e.error}');
|
||||
print('DioException Response: ${e.response}');
|
||||
} else {
|
||||
print('Exception: $e');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,13 +9,14 @@ import 'logic.dart';
|
||||
class MinefragmentPage extends StatelessWidget {
|
||||
MinefragmentPage({Key? key}) : super(key: key);
|
||||
|
||||
// final logic = Get.lazyPut(() => MinefragmentLogic());
|
||||
final logic = Get.lazyPut(() => MinefragmentLogic());
|
||||
|
||||
// final state = Get.find<MinefragmentLogic>().state;
|
||||
final state = Get.find<MinefragmentLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double statusBarHeight = MediaQuery.of(context).padding.top;
|
||||
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
width: Get.width,
|
||||
@ -377,7 +378,9 @@ class MinefragmentPage extends StatelessWidget {
|
||||
return ClipOval(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
// Get.toNamed(AppRoutes.Swiper,arguments:imgList);
|
||||
var imgList = <String>[];
|
||||
imgList.add("https://book.flutterchina.club/assets/img/logo.png");
|
||||
Get.toNamed(AppRoutes.Swiper,arguments:imgList);
|
||||
},
|
||||
child: Image.network(
|
||||
'https://book.flutterchina.club/assets/img/logo.png',
|
||||
|
||||
@ -73,7 +73,7 @@ class _OffaccountState extends State<OffaccountPage> {
|
||||
backgroundColor: Colors.transparent,
|
||||
body: SingleChildScrollView(
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(16),
|
||||
padding: EdgeInsets.all(16.sp),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@ -82,49 +82,49 @@ class _OffaccountState extends State<OffaccountPage> {
|
||||
"注销后,你的账号将",
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
fontSize: 16.sp,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
SizedBox(height: 8.sp),
|
||||
Text(
|
||||
"1、无法登录跨友app;",
|
||||
style: TextStyle(
|
||||
color: Color(0xFFB7BECC),
|
||||
fontSize: 12,
|
||||
fontSize: 12.sp,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"2、所有信息将被永远删除:身份信息、账户信息、会员、喊话、相册等内容;",
|
||||
style: TextStyle(
|
||||
color: Color(0xFFB7BECC),
|
||||
fontSize: 12,
|
||||
fontSize: 12.sp,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"3、您的好友无法与你取得联系(包括关注、粉丝等);",
|
||||
style: TextStyle(
|
||||
color: Color(0xFFB7BECC),
|
||||
fontSize: 12,
|
||||
fontSize: 12.sp,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"4、注销后,一个月内该手机号将无法注册新的账号。",
|
||||
style: TextStyle(
|
||||
color: Color(0xFFB7BECC),
|
||||
fontSize: 12,
|
||||
fontSize: 12.sp,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
SizedBox(height: 10.sp),
|
||||
|
||||
// 输入手机号或邮箱
|
||||
Text(
|
||||
"请输入绑定的手机号",
|
||||
style: TextStyle(
|
||||
color: Color(0xFF898F99),
|
||||
fontSize: 10,
|
||||
fontSize: 10.sp,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
SizedBox(height: 10.sp),
|
||||
TextFormField(
|
||||
controller: logic.state.photoController,
|
||||
keyboardType: TextInputType.phone,
|
||||
@ -136,7 +136,7 @@ class _OffaccountState extends State<OffaccountPage> {
|
||||
hintText: "请输入手机号",
|
||||
hintStyle: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14,
|
||||
fontSize: 14.sp,
|
||||
),
|
||||
filled: true,
|
||||
fillColor: Color(0xFF000000),
|
||||
@ -144,34 +144,34 @@ class _OffaccountState extends State<OffaccountPage> {
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 16),
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 16.sp),
|
||||
),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14,
|
||||
fontSize: 14.sp,
|
||||
),
|
||||
// enabled: countdown == 0, // 当倒计时结束后才可编辑
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
SizedBox(height: 16.sp),
|
||||
|
||||
// 选择注销原因
|
||||
Text(
|
||||
"请选择你的注销原因",
|
||||
style: TextStyle(
|
||||
color: Color(0xFF898F99),
|
||||
fontSize: 10,
|
||||
fontSize: 10.sp,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
SizedBox(height: 10.sp),
|
||||
GestureDetector(onTap: () {
|
||||
showBottomSheetDialog(context,logic);
|
||||
},
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 40,
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
height: 40.sp,
|
||||
margin: EdgeInsets.only(top: 10.sp),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
borderRadius: BorderRadius.circular(4.sp),
|
||||
color: Color(0xFF000000),
|
||||
),
|
||||
child: Row(
|
||||
@ -183,27 +183,27 @@ class _OffaccountState extends State<OffaccountPage> {
|
||||
hintText: logic.state.offReasonMsg,
|
||||
hintStyle: TextStyle(
|
||||
color: Color(0xFFF7FAFA),
|
||||
fontSize: 14,
|
||||
fontSize: 14.sp,
|
||||
),
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.only(left: 16),
|
||||
contentPadding: EdgeInsets.only(left: 16.sp),
|
||||
),
|
||||
style: TextStyle(
|
||||
color: Color(0xFFF7FAFA),
|
||||
fontSize: 14,
|
||||
fontSize: 14.sp,
|
||||
),
|
||||
),
|
||||
),
|
||||
Image.asset(
|
||||
getHomeImage("icon_in"),
|
||||
width: 14,
|
||||
height: 14,
|
||||
width: 14.sp,
|
||||
height: 14.sp,
|
||||
),
|
||||
],
|
||||
),
|
||||
),)
|
||||
,
|
||||
SizedBox(height: 42),
|
||||
SizedBox(height: 42.sp),
|
||||
|
||||
// 注销按钮
|
||||
GestureDetector(
|
||||
@ -213,7 +213,7 @@ class _OffaccountState extends State<OffaccountPage> {
|
||||
}, child: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Container(
|
||||
width: 160,
|
||||
width: 160.sp,
|
||||
child: ElevatedButton(
|
||||
onPressed: (){
|
||||
handleLogout(logic);
|
||||
@ -227,7 +227,7 @@ class _OffaccountState extends State<OffaccountPage> {
|
||||
),
|
||||
shape: MaterialStateProperty.all<OutlinedBorder>(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(17),
|
||||
borderRadius: BorderRadius.circular(17.sp),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@ -113,60 +113,14 @@ class _PhotoinfoPage extends State<PhotoinfoPage> {
|
||||
hintText: "请输入已绑定手机号",
|
||||
hintStyle: TextStyle(
|
||||
color: Colors.grey.shade300,
|
||||
fontSize: 14.0,
|
||||
fontSize: 14.0.sp,
|
||||
),
|
||||
border: InputBorder.none,
|
||||
),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14.0,
|
||||
height: 1.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.fromLTRB(16.0, 20.0, 16.0, 0.0),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(4.0),
|
||||
color: Color(0xff282733),
|
||||
),
|
||||
height: 40.0,
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: EdgeInsets.only(left: 10.0.sp, right: 10.sp),
|
||||
child: Image(
|
||||
image: AssetImage(getMineImage("im_lock")),
|
||||
width: 24.sp,
|
||||
height: 24.sp,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
height: 32.sp,
|
||||
alignment: Alignment.center,
|
||||
child: TextField(
|
||||
controller: _passwordController,
|
||||
textAlignVertical: TextAlignVertical.center,
|
||||
obscureText: true, // 设置为true以隐藏用户输入的内容
|
||||
|
||||
decoration: InputDecoration(
|
||||
hintText: "请输入密码",
|
||||
hintStyle: TextStyle(
|
||||
color: Colors.grey.shade300,
|
||||
fontSize: 14.0,
|
||||
),
|
||||
border: InputBorder.none,
|
||||
),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14.0,
|
||||
height: 1.0,
|
||||
fontSize: 14.0.sp,
|
||||
height: 1.0.sp,
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -174,6 +128,52 @@ class _PhotoinfoPage extends State<PhotoinfoPage> {
|
||||
],
|
||||
),
|
||||
),
|
||||
// Container(
|
||||
// margin: EdgeInsets.fromLTRB(16.0, 20.0, 16.0, 0.0),
|
||||
// decoration: BoxDecoration(
|
||||
// borderRadius: BorderRadius.circular(4.0),
|
||||
// color: Color(0xff282733),
|
||||
// ),
|
||||
// height: 40.0,
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Container(
|
||||
// alignment: Alignment.centerLeft,
|
||||
// padding: EdgeInsets.only(left: 10.0.sp, right: 10.sp),
|
||||
// child: Image(
|
||||
// image: AssetImage(getMineImage("im_lock")),
|
||||
// width: 24.sp,
|
||||
// height: 24.sp,
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: Container(
|
||||
// height: 32.sp,
|
||||
// alignment: Alignment.center,
|
||||
// child: TextField(
|
||||
// controller: _passwordController,
|
||||
// textAlignVertical: TextAlignVertical.center,
|
||||
// obscureText: true, // 设置为true以隐藏用户输入的内容
|
||||
//
|
||||
// decoration: InputDecoration(
|
||||
// hintText: "请输入密码",
|
||||
// hintStyle: TextStyle(
|
||||
// color: Colors.grey.shade300,
|
||||
// fontSize: 14.0,
|
||||
// ),
|
||||
// border: InputBorder.none,
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// color: Colors.white,
|
||||
// fontSize: 14.0,
|
||||
// height: 1.0,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
Container(
|
||||
margin:
|
||||
EdgeInsets.fromLTRB(16.0.sp, 20.0.sp, 16.0.sp, 0.0.sp),
|
||||
@ -212,14 +212,14 @@ class _PhotoinfoPage extends State<PhotoinfoPage> {
|
||||
hintText: "请输入新手机号",
|
||||
hintStyle: TextStyle(
|
||||
color: Colors.grey.shade300,
|
||||
fontSize: 14.0,
|
||||
fontSize: 14.0.sp,
|
||||
),
|
||||
border: InputBorder.none,
|
||||
),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14.0,
|
||||
height: 1.0,
|
||||
fontSize: 14.0.sp,
|
||||
height: 1.0.sp,
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -262,14 +262,14 @@ class _PhotoinfoPage extends State<PhotoinfoPage> {
|
||||
hintText: "请输入验证码",
|
||||
hintStyle: TextStyle(
|
||||
color: Colors.grey.shade300,
|
||||
fontSize: 14.0,
|
||||
fontSize: 14.0.sp,
|
||||
),
|
||||
border: InputBorder.none,
|
||||
),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14.0,
|
||||
height: 1.0,
|
||||
fontSize: 14.0.sp,
|
||||
height: 1.0.sp,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@ -1,10 +1,13 @@
|
||||
|
||||
import 'package:circle_app/components/my_app_bar.dart';
|
||||
import 'package:circle_app/util/util.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../router/app_routers.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
|
||||
@ -16,6 +19,7 @@ class SetupPage extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// _getFormat(context);
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
@ -80,7 +84,7 @@ class SetupPage extends StatelessWidget {
|
||||
SizedBox(height: 16.sp),
|
||||
// _buildItemRow('系统权限管理', getHomeImage("icon_in")),
|
||||
// SizedBox(height: 16.sp),
|
||||
_buildCacheItemRow('清除缓存', getHomeImage("icon_in")),
|
||||
_buildCacheItemRow('清除缓存', getHomeImage("icon_in"),context),
|
||||
SizedBox(height: 16.sp),
|
||||
|
||||
GestureDetector(
|
||||
@ -119,7 +123,7 @@ class SetupPage extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCacheItemRow(String text, String imagePath) {
|
||||
Widget _buildCacheItemRow(String text, String imagePath,BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.sp), // 将 @dimen/dp_16 替换为相应的值
|
||||
child: Row(
|
||||
@ -132,6 +136,7 @@ class SetupPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
// _getFormat(context),
|
||||
Text(
|
||||
'XXX', // 将 'XXX' 替换为相应的缓存大小值
|
||||
style: TextStyle(
|
||||
|
||||
@ -4,5 +4,5 @@ import 'state.dart';
|
||||
|
||||
class SwiperLogic extends GetxController {
|
||||
final SwiperState state = SwiperState();
|
||||
List<Map> imgList = Get.arguments ;
|
||||
List<String> imgList = Get.arguments ;
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ class _SwiperPageState extends State<SwiperPage> {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
child: Image.network(
|
||||
logic.imgList[index]['url'], fit: BoxFit.contain,)
|
||||
logic.imgList[index], fit: BoxFit.contain,)
|
||||
);
|
||||
},
|
||||
itemCount: logic.imgList.length,
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
class UserinfoState {
|
||||
UserinfoState() {
|
||||
|
||||
///Initialize variables
|
||||
}
|
||||
List<String> imaglist = ["https://book.flutterchina.club/assets/img/logo.png",
|
||||
"https://book.flutterchina.club/assets/img/logo.png",
|
||||
"https://book.flutterchina.club/assets/img/logo.png",
|
||||
"https://book.flutterchina.club/assets/img/logo.png",
|
||||
"https://book.flutterchina.club/assets/img/logo.png",
|
||||
"https://book.flutterchina.club/assets/img/logo.png",];
|
||||
}
|
||||
|
||||
@ -363,13 +363,14 @@ class _MyTabbedScreenState extends State<UserinfoPage>
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 3, // 每行显示的项目数量
|
||||
),
|
||||
itemCount: 20, // 项目的总数量,包括固定图片和接口获取的项目
|
||||
itemCount: controller.state.imaglist.length+1, // 项目的总数量,包括固定图片和接口获取的项目
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
if (index == 0) {
|
||||
// 第一个项目,显示固定的图片
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
controller.getImageFile();
|
||||
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(5.sp),
|
||||
@ -386,8 +387,8 @@ class _MyTabbedScreenState extends State<UserinfoPage>
|
||||
margin: EdgeInsets.all(5.sp),
|
||||
child: Center(
|
||||
child: _buildImageItem(
|
||||
'https://book.flutterchina.club/assets/img/logo.png',
|
||||
controller)),
|
||||
controller.state.imaglist[index-1],
|
||||
controller,index-1)),
|
||||
);
|
||||
}
|
||||
},
|
||||
@ -481,7 +482,11 @@ class _MyTabbedScreenState extends State<UserinfoPage>
|
||||
Widget _buildAvatar1(UserinfoLogic controller) {
|
||||
return ClipOval(
|
||||
child: GestureDetector(
|
||||
onTap: () {},
|
||||
onTap: () {
|
||||
var imgList = <String>[];
|
||||
imgList.add("https://book.flutterchina.club/assets/img/logo.png");
|
||||
Get.toNamed(AppRoutes.Swiper,arguments:imgList);
|
||||
},
|
||||
child: Image.network(
|
||||
'https://book.flutterchina.club/assets/img/logo.png',
|
||||
width: 66.sp,
|
||||
@ -491,14 +496,14 @@ class _MyTabbedScreenState extends State<UserinfoPage>
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildImageItem(String url, UserinfoLogic controller) {
|
||||
Widget _buildImageItem(String url, UserinfoLogic controller,int index) {
|
||||
return Stack(
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(0.0),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
showToast("点击了图片");
|
||||
Get.toNamed(AppRoutes.Swiper,arguments:controller.state.imaglist);
|
||||
},
|
||||
child: Image.network(
|
||||
url,
|
||||
@ -511,7 +516,9 @@ class _MyTabbedScreenState extends State<UserinfoPage>
|
||||
right: 0,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
showToast("删除");
|
||||
// showToast("删除");
|
||||
_showDelImgDialog(context,controller,index);
|
||||
|
||||
},
|
||||
child: Image(
|
||||
image: AssetImage(getMineImage("icon_img_del")),
|
||||
@ -605,6 +612,151 @@ class _MyTabbedScreenState extends State<UserinfoPage>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void _showDelImgDialog(BuildContext context,UserinfoLogic controller,int index) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return Dialog(
|
||||
backgroundColor: Colors.transparent,
|
||||
child: Container(
|
||||
height: 160.sp,
|
||||
padding: EdgeInsets.all(1.0),
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
gradient: LinearGradient(
|
||||
colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)],
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.all(1.sp),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
gradient: LinearGradient(
|
||||
colors: [Color(0xFF4C3E5F), Color(0xFF324140)],
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 24.sp),
|
||||
child: Column(
|
||||
children: [
|
||||
Center(
|
||||
child: Text(
|
||||
"提示",
|
||||
style:
|
||||
TextStyle(color: Colors.white, fontSize: 16.sp),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(
|
||||
top: 12.sp, left: 14.sp, right: 14.sp),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
"是否确认删除该形象照。",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Color(0xCCF7FAFA), fontSize: 16.sp),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 30.sp),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(17),
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
Color(0x26FFFFFF),
|
||||
Color(0x26FFFFFF),
|
||||
],
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
),
|
||||
),
|
||||
padding: EdgeInsets.only(
|
||||
top: 10.sp,
|
||||
bottom: 10.sp,
|
||||
left: 52.sp,
|
||||
right: 52.sp),
|
||||
child: Text(
|
||||
"否",
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 24.sp),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
controller.state.imaglist.removeAt(index);
|
||||
controller.update();
|
||||
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 24.sp),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(17),
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
Color(0xFF06F9FA),
|
||||
Color(0xFFDC5BFD),
|
||||
],
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
),
|
||||
),
|
||||
padding: EdgeInsets.only(
|
||||
top: 10.sp,
|
||||
bottom: 10.sp,
|
||||
left: 52.sp,
|
||||
right: 52.sp),
|
||||
child: Text(
|
||||
"是",
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void _showReportDialog(BuildContext context) {
|
||||
showDialog(
|
||||
context: context,
|
||||
|
||||
10
circle_app/lib/app/webview/binding.dart
Normal file
10
circle_app/lib/app/webview/binding.dart
Normal file
@ -0,0 +1,10 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
class WebviewBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.lazyPut(() => WebviewLogic());
|
||||
}
|
||||
}
|
||||
10
circle_app/lib/app/webview/logic.dart
Normal file
10
circle_app/lib/app/webview/logic.dart
Normal file
@ -0,0 +1,10 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'state.dart';
|
||||
|
||||
class WebviewLogic extends GetxController {
|
||||
final WebviewState state = WebviewState();
|
||||
|
||||
final title = Get.arguments['title'];
|
||||
|
||||
}
|
||||
5
circle_app/lib/app/webview/state.dart
Normal file
5
circle_app/lib/app/webview/state.dart
Normal file
@ -0,0 +1,5 @@
|
||||
class WebviewState {
|
||||
WebviewState() {
|
||||
///Initialize variables
|
||||
}
|
||||
}
|
||||
70
circle_app/lib/app/webview/view.dart
Normal file
70
circle_app/lib/app/webview/view.dart
Normal file
@ -0,0 +1,70 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
import '../../components/my_app_bar.dart';
|
||||
import '../../util/util.dart';
|
||||
import 'logic.dart';
|
||||
|
||||
class WebviewPage extends StatefulWidget {
|
||||
@override
|
||||
createState() => _WebViewContainerState();
|
||||
}
|
||||
|
||||
class _WebViewContainerState extends State<WebviewPage> {
|
||||
// Get.toNamed(AppRoutes.WebViewActivity,arguments: {'title':"百度","url":"https://www.baidu.com"});
|
||||
|
||||
_WebViewContainerState();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final url = Get.arguments['url'];
|
||||
var controller = WebViewController()
|
||||
..setJavaScriptMode(JavaScriptMode.unrestricted)
|
||||
..setBackgroundColor( Colors.transparent)
|
||||
..setNavigationDelegate(
|
||||
NavigationDelegate(
|
||||
onProgress: (int progress) {
|
||||
// Update loading bar.
|
||||
},
|
||||
onPageStarted: (String url) {},
|
||||
onPageFinished: (String url) {},
|
||||
onWebResourceError: (WebResourceError error) {},
|
||||
onNavigationRequest: (NavigationRequest request) {
|
||||
if (request.url.startsWith('')) {
|
||||
return NavigationDecision.prevent;
|
||||
}
|
||||
return NavigationDecision.navigate;
|
||||
},
|
||||
),
|
||||
)
|
||||
..loadRequest(Uri.parse(url));
|
||||
return GetBuilder<WebviewLogic>(builder: (logic) {
|
||||
return Builder(
|
||||
builder: (context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(getBaseImage("home_back")),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: MyAppBar(centerTitle: logic.title,),
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: WebViewWidget(
|
||||
controller: controller,
|
||||
),
|
||||
),
|
||||
],
|
||||
),),
|
||||
);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,8 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'network/network.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const MyApp());
|
||||
}
|
||||
@ -17,6 +19,7 @@ class MyApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
//填入设计稿中设备的屏幕尺寸,单位dp
|
||||
configureDio();
|
||||
return ScreenUtilInit(
|
||||
designSize: const Size(375, 812),
|
||||
minTextAdapt: true,
|
||||
|
||||
76
circle_app/lib/network/network.dart
Normal file
76
circle_app/lib/network/network.dart
Normal file
@ -0,0 +1,76 @@
|
||||
import 'dart:io';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:dio/io.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../util/device.dart';
|
||||
|
||||
final dio = Dio(); // 初始化默认的配置
|
||||
|
||||
void configureDio() {
|
||||
// 通过BaseOptions设置默认配置
|
||||
dio.options.baseUrl = 'http://192.168.3.55:2000/';
|
||||
dio.options.connectTimeout = Duration(seconds: 5);
|
||||
dio.options.receiveTimeout = Duration(seconds: 3);
|
||||
|
||||
//添加拦截器
|
||||
//自定义拦截器,请求、返回、异常三种拦截器
|
||||
dio.interceptors.add(Interceptor());
|
||||
// dio.interceptors.add(ErrorInterceptor());
|
||||
// dio.interceptors.add(ResponceInterceptor());
|
||||
//日志记录
|
||||
dio.interceptors.add(LogInterceptor(responseBody: true));
|
||||
dio.interceptors.add(InterceptorsWrapper(
|
||||
onRequest: (RequestOptions options, RequestInterceptorHandler handler) {
|
||||
// 在这里对请求进行拦截和修改
|
||||
// 添加公共请求头
|
||||
|
||||
options.headers['Authorization'] = getAuthorization();
|
||||
options.headers['version'] = getDeviceId();
|
||||
if(Platform.isIOS){
|
||||
options.headers['platform'] = '1';
|
||||
}else if(Platform.isAndroid){
|
||||
options.headers['platform'] = '0';
|
||||
}
|
||||
options.headers['imei'] = getImei();
|
||||
options.headers['brand'] = getBrand();
|
||||
|
||||
|
||||
//
|
||||
// // 修改请求参数
|
||||
// options.queryParameters['key'] = 'value';
|
||||
|
||||
// 继续请求
|
||||
return handler.next(options);
|
||||
},
|
||||
onResponse: (Response response, ResponseInterceptorHandler handler) {
|
||||
// 在这里可以对响应进行处理
|
||||
// ...
|
||||
print("onResponse");
|
||||
// 继续处理响应
|
||||
return handler.next(response);
|
||||
},
|
||||
onError: (DioException error, ErrorInterceptorHandler handler) {
|
||||
// 在这里处理请求错误
|
||||
// ...
|
||||
print("onError");
|
||||
// 继续处理错误
|
||||
return handler.next(error);
|
||||
},
|
||||
));
|
||||
|
||||
// 设置代理
|
||||
// (dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = (client) {
|
||||
// client.badCertificateCallback = (X509Certificate cert, String host, int port) => true;
|
||||
// // config the http client
|
||||
// client.findProxy = (uri) {
|
||||
// //proxy all request to localhost:8888
|
||||
// return "PROXY http://192.168.3.55:2000"; // 替换为实际的代理主机和端口
|
||||
// };
|
||||
// // you can also create a new HttpClient to dio
|
||||
// // return new HttpClient();
|
||||
// };
|
||||
|
||||
// 通过BaseOptions构造函数设置
|
||||
|
||||
}
|
||||
@ -34,6 +34,8 @@ import 'package:circle_app/app/text/binding.dart';
|
||||
import 'package:circle_app/app/text/view.dart';
|
||||
import 'package:circle_app/app/userinfo/binding.dart';
|
||||
import 'package:circle_app/app/userinfo/view.dart';
|
||||
import 'package:circle_app/app/webview/binding.dart';
|
||||
import 'package:circle_app/app/webview/view.dart';
|
||||
import 'package:get/get_navigation/src/routes/get_route.dart';
|
||||
|
||||
import '../app/blacklist/view.dart';
|
||||
@ -134,5 +136,10 @@ class AppPages {
|
||||
page: () => OffaccountPage(),
|
||||
binding: OffaccountBinding(),
|
||||
),
|
||||
GetPage(
|
||||
name: AppRoutes.WebViewActivity,
|
||||
page: () => WebviewPage(),
|
||||
binding: WebviewBinding(),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
@ -18,4 +18,5 @@ abstract class AppRoutes {
|
||||
static const TextActivity = '/user/TextActivity';
|
||||
static const Swiper = '/user/Swiper';
|
||||
static const OffAccountActivity = '/user/OffAccountActivity';
|
||||
static const WebViewActivity = '/user/WebViewActivity';
|
||||
}
|
||||
53
circle_app/lib/util/device.dart
Normal file
53
circle_app/lib/util/device.dart
Normal file
@ -0,0 +1,53 @@
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:device_info/device_info.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
Future<String> getDeviceId() async {
|
||||
String deviceId = "";
|
||||
final DeviceInfoPlugin deviceInfoPlugin = new DeviceInfoPlugin();
|
||||
try {
|
||||
if (Platform.isAndroid) {
|
||||
var build = await deviceInfoPlugin.androidInfo;
|
||||
deviceId = build.androidId; // Android
|
||||
} else if (Platform.isIOS) {
|
||||
var data = await deviceInfoPlugin.iosInfo;
|
||||
deviceId = data.identifierForVendor; // iOS
|
||||
}
|
||||
} catch (e) {
|
||||
print('Failed to get device id: $e');
|
||||
}
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
Future<String> getImei() async{
|
||||
String imei = "";
|
||||
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
|
||||
if (Platform.isAndroid) {
|
||||
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
|
||||
String imei = androidInfo.androidId;
|
||||
// other specific Android data
|
||||
} else if (Platform.isIOS) {
|
||||
IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
|
||||
imei = iosInfo.identifierForVendor;
|
||||
// other specific iOS data
|
||||
}
|
||||
return imei;
|
||||
}
|
||||
Future<String> getBrand() async{
|
||||
String brand = '';
|
||||
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
|
||||
if(Platform.isIOS){
|
||||
IosDeviceInfo iosDeviceInfo = await deviceInfo.iosInfo;
|
||||
brand = iosDeviceInfo.model;
|
||||
}else if(Platform.isAndroid){
|
||||
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
|
||||
brand = androidInfo.model;
|
||||
}
|
||||
return brand;
|
||||
}
|
||||
Future<String> getAuthorization() async{
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
return prefs.getString("Authorization") ?? "";
|
||||
}
|
||||
@ -54,6 +54,15 @@ dependencies:
|
||||
flutter_pickers: ^2.1.9
|
||||
#七牛
|
||||
qiniu_flutter_sdk: ^0.5.0
|
||||
#内置游览器插件
|
||||
webview_flutter: ^4.2.2
|
||||
#http
|
||||
dio: ^5.0.0
|
||||
#获取设备信息
|
||||
device_info: ^2.0.3
|
||||
|
||||
shared_preferences: ^2.1.2
|
||||
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user