Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
ChatGPT
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
关振斌
ChatGPT
Commits
70214295
Commit
70214295
authored
Feb 15, 2023
by
关振斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
644751c6
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
415 additions
and
171 deletions
+415
-171
lib/constant/app_urls.dart
lib/constant/app_urls.dart
+2
-1
lib/entity/plan_entity.dart
lib/entity/plan_entity.dart
+34
-0
lib/entity/user_entity.dart
lib/entity/user_entity.dart
+6
-5
lib/main.dart
lib/main.dart
+1
-0
lib/models/app_model.dart
lib/models/app_model.dart
+30
-15
lib/models/user_model.dart
lib/models/user_model.dart
+29
-2
lib/pages/dashboard/components/banner.dart
lib/pages/dashboard/components/banner.dart
+24
-19
lib/pages/dashboard/dashboard_page.dart
lib/pages/dashboard/dashboard_page.dart
+6
-1
lib/pages/home/home_page.dart
lib/pages/home/home_page.dart
+7
-1
lib/pages/user/user_back.dart
lib/pages/user/user_back.dart
+145
-0
lib/pages/user/user_page.dart
lib/pages/user/user_page.dart
+112
-126
lib/service/plan_service.dart
lib/service/plan_service.dart
+10
-0
lib/utils/http_util.dart
lib/utils/http_util.dart
+1
-1
pubspec.lock
pubspec.lock
+7
-0
pubspec.yaml
pubspec.yaml
+1
-0
No files found.
lib/constant/app_urls.dart
View file @
70214295
class
AppUrls
{
static
const
String
baseUrl
=
'http://1
01.34.153.228
:8083'
;
// 基础接口地址
static
const
String
baseUrl
=
'http://1
92.168.110.1
:8083'
;
// 基础接口地址
static
const
String
baseApiUrl
=
'
${baseUrl}
/api'
;
// 基础接口地址
// http://101.34.153.228:8083/api/doc.html
...
...
@@ -24,4 +24,5 @@ class AppUrls {
static
const
String
sendSms
=
'
$baseApiUrl
/sms/sendSms'
;
static
const
String
applePayCallBack
=
'
$baseApiUrl
/pay/notifyApplePay'
;
static
const
String
register
=
'
$baseApiUrl
/user/register'
;
static
const
String
getClassifyList
=
'
$baseApiUrl
/classify/getClassifyList'
;
}
lib/entity/plan_entity.dart
View file @
70214295
...
...
@@ -134,3 +134,37 @@ class MessageEntity {
List
<
MessageEntity
>
messageEntityFromList
(
List
data
)
=>
List
<
MessageEntity
>.
from
(
data
.
map
((
x
)
=>
MessageEntity
.
fromMap
(
x
)));
class
ClassifyEntity
{
ClassifyEntity
({
required
this
.
id
,
required
this
.
classifyName
,
required
this
.
classifyDesc
,
required
this
.
isShow
,
});
final
int
id
;
final
String
classifyName
;
final
String
classifyDesc
;
final
int
isShow
;
factory
ClassifyEntity
.
fromJson
(
String
str
)
=>
ClassifyEntity
.
fromMap
(
json
.
decode
(
str
));
String
toJson
()
=>
json
.
encode
(
toMap
());
factory
ClassifyEntity
.
fromMap
(
Map
<
String
,
dynamic
>
json
)
=>
ClassifyEntity
(
id:
json
[
"id"
],
classifyName:
json
[
"classifyName"
],
classifyDesc:
json
[
"classifyDesc"
],
isShow:
json
[
'isShow'
]);
Map
<
String
,
dynamic
>
toMap
()
=>
{
"id"
:
id
,
"classifyName"
:
classifyName
,
"classifyDesc"
:
classifyDesc
,
"isShow"
:
isShow
};
}
List
<
ClassifyEntity
>
classifyEntityFromList
(
List
data
)
=>
List
<
ClassifyEntity
>.
from
(
data
.
map
((
x
)
=>
ClassifyEntity
.
fromMap
(
x
)));
lib/entity/user_entity.dart
View file @
70214295
...
...
@@ -102,10 +102,12 @@ class UserEntity {
}
class
IntegralEntity
{
IntegralEntity
({
required
this
.
id
,
required
this
.
username
});
IntegralEntity
(
{
required
this
.
id
,
required
this
.
username
,
required
this
.
token
});
final
int
id
;
final
String
username
;
final
String
token
;
factory
IntegralEntity
.
fromJson
(
String
str
)
=>
IntegralEntity
.
fromMap
(
json
.
decode
(
str
));
...
...
@@ -113,11 +115,10 @@ class IntegralEntity {
String
toJson
()
=>
json
.
encode
(
toMap
());
factory
IntegralEntity
.
fromMap
(
Map
<
String
,
dynamic
>
json
)
=>
IntegralEntity
(
id:
json
[
"id"
],
username:
json
[
"username"
],
);
id:
json
[
"id"
],
username:
json
[
"username"
],
token:
json
[
'token'
]);
Map
<
String
,
dynamic
>
toMap
()
=>
{
"isd"
:
id
,
"username"
:
username
};
Map
<
String
,
dynamic
>
toMap
()
=>
{
"isd"
:
id
,
"username"
:
username
,
"token"
:
token
};
}
// To parse this JSON data, do
...
...
lib/main.dart
View file @
70214295
...
...
@@ -28,6 +28,7 @@ void main() async {
var
userViewModel
=
UserModel
();
userViewModel
.
refreshData
();
// appModel.getClassFyList();
// var appModel = AppModel();
// var userViewModel = UserModel();
// var userSubscribeModel = UserSubscribeModel();
...
...
lib/models/app_model.dart
View file @
70214295
...
...
@@ -3,32 +3,47 @@ import 'package:flutter/material.dart';
// import 'package:sail/channels/vpn_manager.dart';
// import 'package:sail/constant/app_strings.dart';
import
'package:chart/models/base_model.dart'
;
import
"package:chart/service/plan_service.dart"
;
import
'../entity/plan_entity.dart'
;
// import 'package:sail/models/server_model.dart';
// import 'package:sail/models/user_model.dart';
// import 'package:sail/utils/common_util.dart';
class
AppModel
extends
BaseModel
{
List
<
ClassifyEntity
>
_classFyList
=
[];
List
<
ClassifyEntity
>
get
classFyList
=>
_classFyList
;
// VpnManager vpnManager = VpnManager();
bool
isOn
=
false
;
//
PageController pageController = PageController(initialPage: 0);
//
String appTitle = 'Sail';
PageController
pageController
=
PageController
(
initialPage:
0
);
String
appTitle
=
'Sail'
;
// Config config = Config();
AppModel
()
{
// General general = General(
// loglevel: 'info',
// logoutput: '{{leafLogFile}}',
// dnsServer: ['223.5.5.5', '114.114.114.114'],
// tunFd: '{{tunFd}}',
// routingDomainResolve: true);
getClassFyList
()
async
{
print
(
"appTitle,
$appTitle
"
);
try
{
List
<
ClassifyEntity
>?
list
=
await
PlanService
().
getClassifyList
();
_classFyList
=
list
!;
}
catch
(
e
)
{
print
(
e
);
}
}
// List<Rule> rules = [];
// // rules.add(Rule(typeField: 'EXTERNAL', target: 'Direct', filter: 'site:cn'));
// rules.add(Rule(typeField: 'FINAL', target: 'Direct'));
// AppModel() {
// // General general = General(
// // loglevel: 'info',
// // logoutput: '{{leafLogFile}}',
// // dnsServer: ['223.5.5.5', '114.114.114.114'],
// // tunFd: '{{tunFd}}',
// // routingDomainResolve: true);
// config.general = general;
// config.rules = rules;
}
// // List<Rule> rules = [];
// // // rules.add(Rule(typeField: 'EXTERNAL', target: 'Direct', filter: 'site:cn'));
// // rules.add(Rule(typeField: 'FINAL', target: 'Direct'));
// // config.general = general;
// // config.rules = rules;
// }
// final Map _tabMap = {
// 0: AppStrings.appName,
...
...
lib/models/user_model.dart
View file @
70214295
...
...
@@ -5,6 +5,9 @@ import 'package:chart/models/base_model.dart';
import
'package:chart/utils/navigator_util.dart'
;
import
'package:chart/utils/shared_preferences_util.dart'
;
import
"package:chart/service/user_service.dart"
;
import
'../entity/plan_entity.dart'
;
import
'../service/plan_service.dart'
;
// import '';
class
UserModel
extends
BaseModel
{
...
...
@@ -16,12 +19,15 @@ class UserModel extends BaseModel {
late
IntegralEntity
?
_integralEntity
;
final
UserService
_userService
=
UserService
();
late
List
<
ClassifyEntity
>
_classFyList
;
String
get
token
=>
_token
;
String
get
authData
=>
_authData
;
UserEntity
?
get
userEntity
=>
_userEntity
;
bool
get
isFirstOpen
=>
_isFirstOpen
;
bool
get
isLogin
=>
_isLogin
;
IntegralEntity
?
get
integralEntity
=>
_integralEntity
;
List
<
ClassifyEntity
>?
get
classFyList
=>
_classFyList
;
Future
<
void
>
checkHasLogin
(
context
,
Function
callback
)
async
{
if
(!
isLogin
)
{
...
...
@@ -32,7 +38,8 @@ class UserModel extends BaseModel {
}
refreshData
()
async
{
_integralEntity
=
IntegralEntity
(
id:
1
,
username:
''
);
_integralEntity
=
IntegralEntity
(
id:
1
,
username:
''
,
token:
""
);
_classFyList
=
[];
_isFirstOpen
=
await
SharedPreferencesUtil
.
getInstance
()
?.
getBool
(
AppStrings
.
isFirstOpen
)
??
true
;
...
...
@@ -119,6 +126,26 @@ class UserModel extends BaseModel {
setIntegralInfo
()
async
{
final
integralEntity
=
await
_userService
.
getUserIntegral
();
_integralEntity
=
integralEntity
;
if
(
integralEntity
!.
token
.
isNotEmpty
)
{
_saveUserToken
(
LoginEntity
(
username:
integralEntity
!.
username
,
id:
integralEntity
.
id
,
token:
integralEntity
.
token
));
print
(
"integralEntity
$integralEntity
"
);
_integralEntity
=
integralEntity
;
}
else
{
//TODO
// print('integralEntityintegralEntity${integralEntity.token}');
}
}
getClassFyList
()
async
{
try
{
List
<
ClassifyEntity
>?
list
=
await
PlanService
().
getClassifyList
();
_classFyList
=
list
!;
}
catch
(
e
)
{
print
(
e
);
}
}
}
lib/pages/dashboard/components/banner.dart
View file @
70214295
import
'package:flutter/material.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:provider/provider.dart'
;
import
'package:smooth_page_indicator/smooth_page_indicator.dart'
;
import
'package:flutter_rating_bar/flutter_rating_bar.dart'
;
import
'package:glassmorphism/glassmorphism.dart'
;
import
'../../../entity/plan_entity.dart'
;
import
'../../../models/app_model.dart'
;
import
'../../../models/user_model.dart'
;
const
List
<
Color
>
kCategoriesPrimaryColor
=
[
Color
(
0xffFFCA8C
),
Color
(
0xff5DF9D3
),
...
...
@@ -73,20 +78,26 @@ class BannerPage extends StatefulWidget {
class
BannerPageState
extends
State
<
BannerPage
>
{
final
controller
=
PageController
(
viewportFraction:
0.8
,
keepPage:
true
);
late
UserModel
_userModel
;
@override
void
didChangeDependencies
()
async
{
super
.
didChangeDependencies
();
}
// final List<BankCardModel> cards = [
// BankCardModel('assets/images/bg_red_card.png', 'Hoang Cuu Long',
// '4221 5168 7464 2283', '08/20', 10000000),
// BankCardModel('assets/images/bg_blue_circle_card.png', 'Hoang Cuu Long',
// '4221 5168 7464 2283', '08/20', 10000000),
// BankCardModel('assets/images/bg_purple_card.png', 'Hoang Cuu Long',
// '4221 5168 7464 2283', '08/20', 10000000),
// BankCardModel('assets/images/bg_blue_card.png', 'Hoang Cuu Long',
// '4221 5168 7464 2283', '08/20', 10000000),
// ];
// @override
// initState() {
// super.initState();
// _appModel = Provider.of<AppModel>(context);
// print("_appModel_appModel_appModel_$_appModel");
// }
@override
Widget
build
(
BuildContext
context
)
{
List
<
ClassifyEntity
>?
list
=
Provider
.
of
<
UserModel
>(
context
).
classFyList
;
print
(
"list
$list
"
);
// print("classFyListclassFyListclassFyList${_userModel.classFyList}");
// TODO: implement build
// final color = kCategoriesSecondryColor[
...
...
@@ -273,11 +284,13 @@ class BannerPageState extends State<BannerPage> {
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
<
Widget
>[
// Text("${_userModel.classFyList.toString()}"),
SizedBox
(
height:
16
),
SizedBox
(
height:
270
,
child:
PageView
.
builder
(
controller:
controller
,
onPageChanged:
(
value
)
=>
{
print
(
"
$value
"
)},
// itemBuilder: (context, index) => {
// // pages[index];
// },
...
...
@@ -290,6 +303,7 @@ class BannerPageState extends State<BannerPage> {
Container
(
// color: Colors.red.withOpacity(.4),
child:
SmoothPageIndicator
(
onDotClicked:
(
index
)
=>
{
print
(
"
$index
"
)},
controller:
controller
,
count:
pages
.
length
,
effect:
CustomizableEffect
(
...
...
@@ -334,12 +348,3 @@ class BannerPageState extends State<BannerPage> {
);
}
}
final
colors
=
const
[
Colors
.
red
,
Colors
.
green
,
Colors
.
greenAccent
,
Colors
.
amberAccent
,
Colors
.
blue
,
Colors
.
amber
,
];
lib/pages/dashboard/dashboard_page.dart
View file @
70214295
...
...
@@ -18,6 +18,8 @@ import 'package:chart/pages/dashboard/components/swiper_column.dart';
import
'package:flutter/cupertino.dart'
;
// import 'package:flutter/material.dart';
import
'package:smooth_page_indicator/smooth_page_indicator.dart'
;
import
'../../models/app_model.dart'
;
//
// import 'package:chart/utils/navigator_util.dart';
// import 'package:flutter_screenutil/flutter_screenutil.dart';
...
...
@@ -32,6 +34,7 @@ class DashBoardPage extends StatefulWidget {
class
DashBoardPageState
extends
State
<
DashBoardPage
>
{
var
guides
=
[
AppImages
.
guide1
,
AppImages
.
guide2
,
AppImages
.
guide3
];
late
UserModel
_userModel
;
late
AppModel
_appModel
;
var
_showButton
=
false
;
@override
...
...
@@ -39,13 +42,15 @@ class DashBoardPageState extends State<DashBoardPage> {
super
.
didChangeDependencies
();
_userModel
=
Provider
.
of
<
UserModel
>(
context
);
_appModel
=
Provider
.
of
<
AppModel
>(
context
);
// _appModel.getClassFyList();
}
// final FocusNode focusNode = FocusNode();
@override
Widget
build
(
BuildContext
context
)
{
UserModel
().
setIsFirstOpen
(
false
);
// print("_appModel_appModel_appModel${_appModel._classFyList}");
return
Scaffold
(
backgroundColor:
Color
(
0xFFF4F4F4
),
body:
Container
(
...
...
lib/pages/home/home_page.dart
View file @
70214295
...
...
@@ -63,6 +63,7 @@ class HomePageState extends State<HomePage> {
// late ServerModel _serverModel;
late
UserModel
_userModel
;
String
_connectionStatus
=
'Unknown'
;
// late UserSubscribeModel _userSubscribeModel;
bool
_isLoadingData
=
false
;
String
_appTitle
=
'GPT大师傅'
;
...
...
@@ -87,6 +88,7 @@ class HomePageState extends State<HomePage> {
.
onConnectivityChanged
.
listen
((
ConnectivityResult
result
)
{
// Navigator.pop();
// await _userModel.setIntegralInfo();
setState
(()
=>
_connectionStatus
=
result
.
toString
());
print
(
"resultresultresultresultresultresult
$result
"
);
// Got a new connectivity status!
...
...
@@ -118,6 +120,7 @@ class HomePageState extends State<HomePage> {
subscription
.
cancel
();
super
.
dispose
();
}
// @override
// initState() {
// super.initState();
...
...
@@ -134,6 +137,7 @@ class HomePageState extends State<HomePage> {
_appModel
=
Provider
.
of
<
AppModel
>(
context
);
_userModel
=
Provider
.
of
<
UserModel
>(
context
);
await
_userModel
.
setIntegralInfo
();
await
_userModel
.
getClassFyList
();
}
void
jumpToPage
(
int
page
)
{
...
...
@@ -146,6 +150,8 @@ class HomePageState extends State<HomePage> {
@override
Widget
build
(
BuildContext
context
)
{
print
(
"_connectionStatus_connectionStatus_connectionStatus
$_connectionStatus
"
);
// WebViewWidget(
// name: "title",
// url: "https://mp.weixin.qq.com/s/AJCPG0b72g4mB3ODM555Cw");
...
...
@@ -218,7 +224,7 @@ class HomePageState extends State<HomePage> {
// highlightElevation: 12.0,
child:
Icon
(
Icons
.
add
),
onPressed:
()
{
print
(
'不要啊~'
);
print
(
'不要啊~'
);
//await _userModel.setIntegralInfo();
Navigator
.
of
(
context
).
pushNamed
(
'/chat'
);
},
),
...
...
lib/pages/user/user_back.dart
0 → 100644
View file @
70214295
import
'package:flutter/material.dart'
;
import
'package:babstrap_settings_screen/babstrap_settings_screen.dart'
;
import
'package:provider/provider.dart'
;
import
'../../models/user_model.dart'
;
class
UserPage
extends
StatefulWidget
{
@override
UserPageState
createState
()
=>
UserPageState
();
}
class
UserPageState
extends
State
<
UserPage
>
{
// final List<BankCardModel> cards = [
// BankCardModel('assets/images/bg_red_card.png', 'Hoang Cuu Long',
// '4221 5168 7464 2283', '08/20', 10000000),
// BankCardModel('assets/images/bg_blue_circle_card.png', 'Hoang Cuu Long',
// '4221 5168 7464 2283', '08/20', 10000000),
// BankCardModel('assets/images/bg_purple_card.png', 'Hoang Cuu Long',
// '4221 5168 7464 2283', '08/20', 10000000),
// BankCardModel('assets/images/bg_blue_card.png', 'Hoang Cuu Long',
// '4221 5168 7464 2283', '08/20', 10000000),
// ];
@override
Widget
build
(
BuildContext
context
)
{
UserModel
_userModel
=
Provider
.
of
<
UserModel
>(
context
);
// TODO: implement build
print
(
"
${_userModel.isLogin}
"
);
// appBar: AppBar(
// title: Text("GPT大师傅"),
// backgroundColor: Color.fromRGBO(41, 45, 62, 1.00),
// ),
// // SailAppBar(
// // appTitle: _appTitle,
// // // rgba(41, 45, 62, 1.00)
// // backgroundColor: Color.fromRGBO(41, 45, 62, 1.00),
// // textColor: Colors.white
// // //rgba(41, 45, 62, 1.00)
// // ),
// // extendBody: true,
// // backgroundColor: Colors.amber,
// // _appModel.isOn ? AppColors.yellowColor : AppColors.grayColor,
// body: Container(
// decoration: BoxDecoration(
// image: DecorationImage(
// image: Image.asset("assets/images/bg.png").image,
// fit: BoxFit.cover),
// ),
return
Container
(
decoration:
BoxDecoration
(
image:
DecorationImage
(
image:
Image
.
asset
(
"assets/images/bg.png"
).
image
,
fit:
BoxFit
.
cover
),
),
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
10
),
child:
ListView
(
children:
[
// User card
BigUserCard
(
// cardColor: Colors.red,
userName:
"Babacar Ndong"
,
userProfilePic:
AssetImage
(
"assets/images/logo.png"
),
cardActionWidget:
SettingsItem
(
icons:
Icons
.
edit
,
iconStyle:
IconStyle
(
withBackground:
true
,
borderRadius:
50
,
backgroundColor:
Colors
.
yellow
[
600
],
),
title:
"Modify"
,
subtitle:
"Tap to change your data"
,
onTap:
()
{
print
(
"OK"
);
},
),
),
SettingsGroup
(
items:
[
SettingsItem
(
onTap:
()
{},
icons:
Icons
.
exit_to_app_rounded
,
iconStyle:
IconStyle
(),
title:
'Appearance'
,
subtitle:
"Make Ziar'App yours"
,
),
SettingsItem
(
onTap:
()
{},
icons:
Icons
.
dark_mode_rounded
,
iconStyle:
IconStyle
(
iconsColor:
Colors
.
white
,
withBackground:
true
,
backgroundColor:
Colors
.
red
,
),
title:
'Dark mode'
,
subtitle:
"Automatic"
,
trailing:
Switch
.
adaptive
(
value:
false
,
onChanged:
(
value
)
{},
),
),
],
),
SettingsGroup
(
items:
[
SettingsItem
(
onTap:
()
{},
icons:
Icons
.
info_rounded
,
iconStyle:
IconStyle
(
backgroundColor:
Colors
.
purple
,
),
title:
'About'
,
subtitle:
"Learn more about Ziar'App"
,
),
],
),
// You can add a settings title
SettingsGroup
(
items:
[
SettingsItem
(
onTap:
()
{
Navigator
.
of
(
context
).
pushNamed
(
'/login'
);
},
icons:
Icons
.
exit_to_app_rounded
,
title:
"
${_userModel.isLogin}
"
,
),
SettingsItem
(
onTap:
()
{},
icons:
Icons
.
exit_to_app_rounded
,
title:
"Delete account"
,
titleStyle:
TextStyle
(
color:
Colors
.
red
,
fontWeight:
FontWeight
.
bold
,
),
),
],
),
],
),
),
);
}
}
lib/pages/user/user_page.dart
View file @
70214295
import
'dart:convert'
;
import
'package:flutter/material.dart'
;
import
'package:babstrap_settings_screen/babstrap_settings_screen.dart'
;
import
'package:provider/provider.dart'
;
import
'package:json_dynamic_form/JsonDynamicForm.dart'
;
import
'package:json_dynamic_form/models/Autogenerated.dart'
;
import
'package:json_dynamic_form/models/Values.dart'
;
import
'package:json_dynamic_form/utils/DynamicFormConstants.dart'
;
import
'../../models/user_model.dart'
;
...
...
@@ -10,136 +16,116 @@ class UserPage extends StatefulWidget {
}
class
UserPageState
extends
State
<
UserPage
>
{
// final List<BankCardModel> cards = [
// BankCardModel('assets/images/bg_red_card.png', 'Hoang Cuu Long',
// '4221 5168 7464 2283', '08/20', 10000000),
// BankCardModel('assets/images/bg_blue_circle_card.png', 'Hoang Cuu Long',
// '4221 5168 7464 2283', '08/20', 10000000),
// BankCardModel('assets/images/bg_purple_card.png', 'Hoang Cuu Long',
// '4221 5168 7464 2283', '08/20', 10000000),
// BankCardModel('assets/images/bg_blue_card.png', 'Hoang Cuu Long',
// '4221 5168 7464 2283', '08/20', 10000000),
// ];
List
<
dynamic
>
data
=
[
{
"type"
:
"text"
,
"label"
:
"Text"
,
"description"
:
"Enter your name"
,
"placeholder"
:
"Enter your name"
,
"regex"
:
""
,
"errorText"
:
""
,
"required"
:
true
,
"name"
:
"text-1622684775448"
},
{
"type"
:
"email"
,
"label"
:
"Email"
,
"description"
:
"Enter your email"
,
"placeholder"
:
"Enter your email"
,
"regex"
:
""
,
"errorText"
:
"Please enter a valid email"
,
"required"
:
true
,
"name"
:
"email-1622684776606"
},
{
"type"
:
"phone"
,
"label"
:
"Phone"
,
"description"
:
"Enter your phone"
,
"placeholder"
:
"Enter your phone"
,
"regex"
:
""
,
"errorText"
:
"Please enter a valid phone number"
,
"required"
:
false
,
"name"
:
"phone-1622684777910"
},
{
"type"
:
"checkbox"
,
"label"
:
"Checkbox"
,
"description"
:
"Checkbox"
,
"values"
:
[
{
"label"
:
"Option 1"
,
"value"
:
"option-1"
},
{
"label"
:
"Option 2"
,
"value"
:
"option-2"
}
],
"name"
:
"checkbox-1622684784550"
},
{
"type"
:
"radio"
,
"label"
:
"Radio"
,
"description"
:
"Radio boxes"
,
"values"
:
[
{
"label"
:
"Option 1"
,
"value"
:
"option-1"
},
{
"label"
:
"Option 2"
,
"value"
:
"option-2"
}
],
"name"
:
"radio-1622684785878"
},
{
"type"
:
"number"
,
"label"
:
"Number"
,
"description"
:
"Age"
,
"placeholder"
:
"Enter your age"
,
"min"
:
12
,
"max"
:
90
,
"name"
:
"number-1622684779623"
},
{
"type"
:
"autocomplete"
,
"label"
:
"Select"
,
"description"
:
"Select"
,
"placeholder"
:
"Select"
,
"values"
:
[
{
"label"
:
"Option 1"
,
"value"
:
"option-1"
},
{
"label"
:
"Option 2"
,
"value"
:
"option-2"
},
{
"label"
:
"Option 3"
,
"value"
:
"option-3"
}
],
"name"
:
"autocomplete-1622684787710"
},
{
"type"
:
"autocomplete"
,
"label"
:
"Select"
,
"description"
:
"Select"
,
"placeholder"
:
"Select"
,
"values"
:
[
{
"label"
:
"Option 4"
,
"value"
:
"option-4"
},
{
"label"
:
"Option 5"
,
"value"
:
"option-5"
},
{
"label"
:
"Option 6"
,
"value"
:
"option-6"
}
],
"name"
:
"autocomplete-prueba"
}
];
//library variables
late
JsonDynamicForm
jsonDynamicForm
;
List
<
Widget
>
fields
=
List
<
Widget
>.
empty
(
growable:
true
);
@override
Widget
build
(
BuildContext
context
)
{
UserModel
_userModel
=
Provider
.
of
<
UserModel
>(
context
);
// TODO: implement build
print
(
"
${_userModel.isLogin}
"
);
// appBar: AppBar(
// title: Text("GPT大师傅"),
// backgroundColor: Color.fromRGBO(41, 45, 62, 1.00),
// ),
// // SailAppBar(
// // appTitle: _appTitle,
// // // rgba(41, 45, 62, 1.00)
// // backgroundColor: Color.fromRGBO(41, 45, 62, 1.00),
// // textColor: Colors.white
// // //rgba(41, 45, 62, 1.00)
// // ),
void
initState
()
{
super
.
initState
();
// // extendBody: true,
// // backgroundColor: Colors.amber,
// // _appModel.isOn ? AppColors.yellowColor : AppColors.grayColor,
// body: Container(
// decoration: BoxDecoration(
// image: DecorationImage(
// image: Image.asset("assets/images/bg.png").image,
// fit: BoxFit.cover),
// ),
jsonDynamicForm
=
JsonDynamicForm
(
data:
data
,
setState:
setState
);
fields
=
jsonDynamicForm
.
generateFields
()!;
}
return
Container
(
decoration:
BoxDecoration
(
image:
DecorationImage
(
image:
Image
.
asset
(
"assets/images/bg.png"
).
image
,
fit:
BoxFit
.
cover
),
),
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
10
),
child:
ListView
(
children:
[
// User card
BigUserCard
(
// cardColor: Colors.red,
userName:
"Babacar Ndong"
,
userProfilePic:
AssetImage
(
"assets/images/logo.png"
),
cardActionWidget:
SettingsItem
(
icons:
Icons
.
edit
,
iconStyle:
IconStyle
(
withBackground:
true
,
borderRadius:
50
,
backgroundColor:
Colors
.
yellow
[
600
],
),
title:
"Modify"
,
subtitle:
"Tap to change your data"
,
onTap:
()
{
print
(
"OK"
);
},
),
),
SettingsGroup
(
items:
[
SettingsItem
(
onTap:
()
{},
icons:
Icons
.
exit_to_app_rounded
,
iconStyle:
IconStyle
(),
title:
'Appearance'
,
subtitle:
"Make Ziar'App yours"
,
),
SettingsItem
(
onTap:
()
{},
icons:
Icons
.
dark_mode_rounded
,
iconStyle:
IconStyle
(
iconsColor:
Colors
.
white
,
withBackground:
true
,
backgroundColor:
Colors
.
red
,
),
title:
'Dark mode'
,
subtitle:
"Automatic"
,
trailing:
Switch
.
adaptive
(
value:
false
,
onChanged:
(
value
)
{},
),
),
],
),
SettingsGroup
(
items:
[
SettingsItem
(
onTap:
()
{},
icons:
Icons
.
info_rounded
,
iconStyle:
IconStyle
(
backgroundColor:
Colors
.
purple
,
),
title:
'About'
,
subtitle:
"Learn more about Ziar'App"
,
),
],
),
// You can add a settings title
SettingsGroup
(
items:
[
SettingsItem
(
onTap:
()
{
Navigator
.
of
(
context
).
pushNamed
(
'/login'
);
},
icons:
Icons
.
exit_to_app_rounded
,
title:
"
${_userModel.isLogin}
"
,
),
SettingsItem
(
onTap:
()
{},
icons:
Icons
.
exit_to_app_rounded
,
title:
"Delete account"
,
titleStyle:
TextStyle
(
color:
Colors
.
red
,
fontWeight:
FontWeight
.
bold
,
),
),
],
),
],
),
),
@override
Widget
build
(
BuildContext
context
)
{
return
SingleChildScrollView
(
child:
Column
(
children:
[
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
fields
),
TextButton
(
onPressed:
getData
,
child:
Text
(
"Get the data!"
))
]),
);
}
getData
()
{
print
(
json
.
encode
(
jsonDynamicForm
.
printData
()));
}
}
lib/service/plan_service.dart
View file @
70214295
...
...
@@ -14,4 +14,14 @@ class PlanService {
return
planEntityFromList
(
result
[
'data'
]);
});
}
Future
<
List
<
ClassifyEntity
>>?
getClassifyList
()
{
return
HttpUtil
.
instance
?.
get
(
AppUrls
.
getClassifyList
).
then
((
result
)
{
return
classifyEntityFromList
(
result
[
'data'
]);
});
}
}
// getClassifyList
lib/utils/http_util.dart
View file @
70214295
...
...
@@ -33,7 +33,7 @@ class HttpUtil {
await
SharedPreferencesUtil
.
getInstance
()
?.
getString
(
AppStrings
.
token
)
.
then
((
token
)
{
if
(
token
!=
null
)
{
if
(
token
!=
null
&&
token
.
isNotEmpty
)
{
options
.
headers
[
'Authorization'
]
=
token
;
// ["Authorization"] = token;
...
...
pubspec.lock
View file @
70214295
...
...
@@ -574,6 +574,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "4.8.0"
json_dynamic_form:
dependency: "direct main"
description:
name: json_dynamic_form
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
linkify:
dependency: transitive
description:
...
...
pubspec.yaml
View file @
70214295
...
...
@@ -94,6 +94,7 @@ dependencies:
intl_phone_field
:
^3.1.0
extended_phone_number_input
:
^1.0.2
gradient_widgets
:
^0.6.0
json_dynamic_form
:
^1.0.0
# package:bubble/bubble.dart
dev_dependencies
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment