Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
A
anchor_collect_flutter
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hywang
anchor_collect_flutter
Commits
23c8f3b0
Commit
23c8f3b0
authored
Dec 22, 2023
by
hywang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.修复一些bug
parent
16cc47d9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
599 additions
and
331 deletions
+599
-331
AndroidManifest.xml
android/app/src/main/AndroidManifest.xml
+1
-1
Info.plist
ios/Runner/Info.plist
+1
-1
ApiException.dart
lib/api/ApiException.dart
+1
-0
HttpUtils.dart
lib/api/HttpUtils.dart
+4
-6
NetWorkConfig.dart
lib/api/NetWorkConfig.dart
+1
-1
apis.dart
lib/api/apis.dart
+1
-1
congifs.dart
lib/congifs.dart
+1
-1
ble_service.dart
lib/controllers/ble_service.dart
+1
-1
cattle_resume_entity.dart
lib/models/cattle_resume_entity.dart
+1
-1
camera_view.dart
lib/pages/camera/camera_view.dart
+18
-5
cattle_resume_list_logic.dart
...e_resume/cattle_resume_list/cattle_resume_list_logic.dart
+39
-8
cattle_resume_list_state.dart
...e_resume/cattle_resume_list/cattle_resume_list_state.dart
+5
-0
cattle_resume_list_view.dart
...le_resume/cattle_resume_list/cattle_resume_list_view.dart
+139
-133
cattle_resume_logic.dart
lib/pages/cattle_resume/cattle_resume_logic.dart
+1
-1
cattle_resume_view.dart
lib/pages/cattle_resume/cattle_resume_view.dart
+92
-82
home_logic.dart
lib/pages/home/home_logic.dart
+5
-9
home_view.dart
lib/pages/home/home_view.dart
+14
-19
login_logic.dart
lib/pages/login/login_logic.dart
+6
-5
login_view.dart
lib/pages/login/login_view.dart
+22
-16
main_view.dart
lib/pages/main/main_view.dart
+6
-1
message_detail_view.dart
lib/pages/message/message_detail/message_detail_view.dart
+1
-0
message_list_view.dart
lib/pages/message/message_list/message_list_view.dart
+1
-0
message_view.dart
lib/pages/message/message_view.dart
+2
-1
mine_view.dart
lib/pages/mine/mine_view.dart
+93
-1
performance_binding.dart
lib/pages/performance/performance_binding.dart
+10
-0
performance_list_binding.dart
...erformance/performance_list/performance_list_binding.dart
+10
-0
performance_list_logic.dart
.../performance/performance_list/performance_list_logic.dart
+7
-0
performance_list_state.dart
.../performance/performance_list/performance_list_state.dart
+5
-0
performance_list_view.dart
...s/performance/performance_list/performance_list_view.dart
+16
-0
performance_logic.dart
lib/pages/performance/performance_logic.dart
+7
-0
performance_state.dart
lib/pages/performance/performance_state.dart
+5
-0
performance_view.dart
lib/pages/performance/performance_view.dart
+16
-0
setting_view.dart
lib/pages/setting/setting_view.dart
+1
-0
sync_logic.dart
lib/pages/sync/sync_logic.dart
+40
-27
sync_view.dart
lib/pages/sync/sync_view.dart
+1
-0
base64_utils.dart
lib/utils/base64_utils.dart
+12
-5
pubspec.lock
pubspec.lock
+10
-2
pubspec.yaml
pubspec.yaml
+2
-2
widget_test.dart
test/widget_test.dart
+1
-1
No files found.
android/app/src/main/AndroidManifest.xml
View file @
23c8f3b0
...
@@ -85,7 +85,7 @@
...
@@ -85,7 +85,7 @@
<uses-permission
android:name=
"android.permission.ACCESS_NOTIFICATION_POLICY"
/>
<uses-permission
android:name=
"android.permission.ACCESS_NOTIFICATION_POLICY"
/>
<application
<application
android:label=
"
良种肉牛追溯系统
"
android:label=
"
掌上牧场
"
android:name=
"${applicationName}"
android:name=
"${applicationName}"
android:icon=
"@mipmap/ic_launcher"
android:icon=
"@mipmap/ic_launcher"
android:usesCleartextTraffic=
"true"
android:usesCleartextTraffic=
"true"
...
...
ios/Runner/Info.plist
View file @
23c8f3b0
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
<
k
e
y
>
CFBundleInfoDictionaryVersion
<
/k
e
y
>
<
k
e
y
>
CFBundleInfoDictionaryVersion
<
/k
e
y
>
<
string
>
6.0
<
/string
>
<
string
>
6.0
<
/string
>
<
k
e
y
>
CFBundleName
<
/k
e
y
>
<
k
e
y
>
CFBundleName
<
/k
e
y
>
<
string
>
良种肉牛追溯系统
<
/string
>
<
string
>
掌上牧场
<
/string
>
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
string
>
APPL
<
/string
>
<
string
>
APPL
<
/string
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
...
...
lib/api/ApiException.dart
View file @
23c8f3b0
import
'package:anchor_collect_flutter/utils/dialog_utils.dart'
;
import
'package:dio/dio.dart'
;
import
'package:dio/dio.dart'
;
import
'api_response.dart'
;
import
'api_response.dart'
;
...
...
lib/api/HttpUtils.dart
View file @
23c8f3b0
...
@@ -154,7 +154,8 @@ class HttpUtils<T> {
...
@@ -154,7 +154,8 @@ class HttpUtils<T> {
_handleResponse
(
response
);
_handleResponse
(
response
);
}
catch
(
e
)
{
}
catch
(
e
)
{
var
exception
=
ApiException
.
from
(
e
);
var
exception
=
ApiException
.
from
(
e
);
DialogUtils
.
dismissDialog
();
// DialogUtils.dismissDialog();
loading
.
dismissLoading
();
if
(
errorCallback
!=
null
)
{
if
(
errorCallback
!=
null
)
{
errorCallback
!(
e
.
toString
(),
exception
.
code
??
-
1
);
errorCallback
!(
e
.
toString
(),
exception
.
code
??
-
1
);
}
}
...
@@ -164,6 +165,7 @@ class HttpUtils<T> {
...
@@ -164,6 +165,7 @@ class HttpUtils<T> {
}
}
void
_handleResponse
(
Response
response
)
{
void
_handleResponse
(
Response
response
)
{
loading
.
dismissLoading
();
if
(
response
.
statusCode
==
200
)
{
if
(
response
.
statusCode
==
200
)
{
ApiResponse
<
T
>
apiResponse
;
ApiResponse
<
T
>
apiResponse
;
if
(
isList
)
{
if
(
isList
)
{
...
@@ -172,7 +174,6 @@ class HttpUtils<T> {
...
@@ -172,7 +174,6 @@ class HttpUtils<T> {
apiResponse
=
ApiResponse
<
T
>.
fromJson
(
response
.
data
);
apiResponse
=
ApiResponse
<
T
>.
fromJson
(
response
.
data
);
}
}
if
(
apiResponse
.
code
==
NetWorkConfig
.
successCode
)
{
if
(
apiResponse
.
code
==
NetWorkConfig
.
successCode
)
{
loading
.
dismissLoading
();
if
(
isList
)
{
if
(
isList
)
{
responseListCallback
?.
call
(
apiResponse
.
list
);
responseListCallback
?.
call
(
apiResponse
.
list
);
}
else
{
}
else
{
...
@@ -181,13 +182,10 @@ class HttpUtils<T> {
...
@@ -181,13 +182,10 @@ class HttpUtils<T> {
}
}
}
}
}
else
{
}
else
{
loading
.
dismissLoading
();
interceptToken
(
apiResponse
.
msg
,
apiResponse
.
code
);
interceptToken
(
apiResponse
.
msg
,
apiResponse
.
code
);
// EasyLoading.showError(apiResponse.message);
// EasyLoading.showError(apiResponse.message);
}
}
}
else
{
}
else
{
loading
.
dismissLoading
();
var
exception
=
var
exception
=
ApiException
(
response
.
statusCode
,
ApiException
.
unknownException
);
ApiException
(
response
.
statusCode
,
ApiException
.
unknownException
);
errorCallback
!(
exception
.
message
??
'服务器异常'
,
exception
.
code
??
-
1
);
errorCallback
!(
exception
.
message
??
'服务器异常'
,
exception
.
code
??
-
1
);
...
@@ -203,7 +201,7 @@ class HttpUtils<T> {
...
@@ -203,7 +201,7 @@ class HttpUtils<T> {
// NetWorkUtils.getVisitorToken();
// NetWorkUtils.getVisitorToken();
break
;
break
;
default
:
default
:
EasyLoading
.
showError
(
msg
);
//
EasyLoading.showError(msg);
errorCallback
!(
msg
,
code
??
-
1
);
errorCallback
!(
msg
,
code
??
-
1
);
break
;
break
;
}
}
...
...
lib/api/NetWorkConfig.dart
View file @
23c8f3b0
...
@@ -4,7 +4,7 @@ import 'package:anchor_collect_flutter/api/apis.dart';
...
@@ -4,7 +4,7 @@ import 'package:anchor_collect_flutter/api/apis.dart';
class
NetWorkConfig
{
class
NetWorkConfig
{
static
String
baseUrl
=
static
String
baseUrl
=
APIS
.
baseUrl
;
APIS
.
baseUrl
;
static
const
int
connectTimeOut
=
1
0
000
;
static
const
int
connectTimeOut
=
1
5
000
;
static
const
int
readTimeOut
=
10000
;
static
const
int
readTimeOut
=
10000
;
static
const
int
writeTimeOut
=
10000
;
static
const
int
writeTimeOut
=
10000
;
static
const
int
successCode
=
0
;
static
const
int
successCode
=
0
;
...
...
lib/api/apis.dart
View file @
23c8f3b0
...
@@ -10,7 +10,7 @@ class APIS{
...
@@ -10,7 +10,7 @@ class APIS{
static
const
login_getMsg
=
"/api/auth/sms"
;
//获取短信验证码接口
static
const
login_getMsg
=
"/api/auth/sms"
;
//获取短信验证码接口
static
const
get_version
=
"/api/getAppVsesion?type=
APP
"
;
//获取版本号
static
const
get_version
=
"/api/getAppVsesion?type=
Flutter
"
;
//获取版本号
static
const
login_interface
=
"/jwt/login"
;
//登录接口
static
const
login_interface
=
"/jwt/login"
;
//登录接口
static
const
login_get_dict
=
"/api/dict/data/list"
;
//登录时获取字典项
static
const
login_get_dict
=
"/api/dict/data/list"
;
//登录时获取字典项
...
...
lib/congifs.dart
View file @
23c8f3b0
...
@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
...
@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
import
'package:get/get.dart'
;
import
'package:get/get.dart'
;
class
Config
{
class
Config
{
static
const
String
appName
=
"
良种肉牛追溯系统
"
;
static
const
String
appName
=
"
掌上牧场
"
;
static
String
baseUrl
=
""
;
static
String
baseUrl
=
""
;
...
...
lib/controllers/ble_service.dart
View file @
23c8f3b0
...
@@ -135,7 +135,7 @@ class BleService extends GetxService {
...
@@ -135,7 +135,7 @@ class BleService extends GetxService {
// 发现服务和特性
// 发现服务和特性
final
services
=
await
ble
.
discoverServices
(
device
.
id
);
final
services
=
await
ble
.
discoverServices
(
device
.
id
);
for
(
final
service
in
services
)
{
for
(
final
service
in
services
)
{
if
(
service
.
serviceId
.
toString
()
==
'000180'
)
{
if
(
service
.
serviceId
.
toString
()
.
startsWith
(
'0000180'
)
)
{
_serviceId
=
service
.
serviceId
;
_serviceId
=
service
.
serviceId
;
if
(
kDebugMode
)
{
if
(
kDebugMode
)
{
print
(
'Discovered service
${service.serviceId}
'
);
print
(
'Discovered service
${service.serviceId}
'
);
...
...
lib/models/cattle_resume_entity.dart
View file @
23c8f3b0
...
@@ -76,7 +76,7 @@ class CattleResumeEntity {
...
@@ -76,7 +76,7 @@ class CattleResumeEntity {
/** 照片路径, 手持机用*/
/** 照片路径, 手持机用*/
String
?
photoPath
;
String
?
photoPath
;
/** 状态(
育种,育成,成年;淘汰,出售
) */
/** 状态(
养殖中1,淘汰2,死亡3,出售4
) */
String
?
status
;
String
?
status
;
/** 是否淘汰;0,在用,1淘汰 */
/** 是否淘汰;0,在用,1淘汰 */
...
...
lib/pages/camera/camera_view.dart
View file @
23c8f3b0
...
@@ -29,11 +29,24 @@ class CameraPage extends StatelessWidget {
...
@@ -29,11 +29,24 @@ class CameraPage extends StatelessWidget {
child:
CameraPreview
(
Config
.
controller
),
// 显示相机预览
child:
CameraPreview
(
Config
.
controller
),
// 显示相机预览
),
),
),
),
ListTile
(
Row
(
children:
[
leading:
const
Icon
(
Icons
.
camera
),
Expanded
(
title:
const
Text
(
'拍照'
),
child:
TextButton
(
onTap:
logic
.
capturePicture
,
// 点击后捕获图片
style:
ButtonStyle
(
),
backgroundColor:
MaterialStateProperty
.
all
(
Colors
.
blue
),
foregroundColor:
MaterialStateProperty
.
all
(
Colors
.
white
),
padding:
MaterialStateProperty
.
all
(
EdgeInsets
.
all
(
15
)),
),
onPressed:
logic
.
capturePicture
,
child:
const
Text
(
"拍照"
),
),
),
]),
// ListTile(
// leading: const Icon(Icons.camera),
// title: const Text('拍照'),
// onTap: logic.capturePicture, // 点击后捕获图片
// ),
],
],
),
),
);
);
...
...
lib/pages/cattle_resume/cattle_resume_list/cattle_resume_list_logic.dart
View file @
23c8f3b0
...
@@ -16,12 +16,15 @@ class CattleResumeListLogic extends GetxController {
...
@@ -16,12 +16,15 @@ class CattleResumeListLogic extends GetxController {
bool
isShow
=
false
;
bool
isShow
=
false
;
queryByFilter
()
async
{
queryByFilter
()
async
{
state
.
dataList
.
clear
();
state
.
dataList
.
clear
();
if
(
EmptyUtils
.
isStrNotEmpty
(
state
.
filterHighNo
)&&
EmptyUtils
.
isStrNotEmpty
(
state
.
filterVisualNo
)&&
if
(!
EmptyUtils
.
isStrNotEmpty
(
state
.
filterHighNo
)
&&
EmptyUtils
.
isStrNotEmpty
(
state
.
filterFatherNo
)&&
EmptyUtils
.
isStrNotEmpty
(
state
.
filterMotherNo
)){
!
EmptyUtils
.
isStrNotEmpty
(
state
.
filterVisualNo
)
&&
state
.
dataList
=
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
filter
().
unidIsNotEmpty
().
findAll
();
!
EmptyUtils
.
isStrNotEmpty
(
state
.
filterFatherNo
)
&&
}
else
{
!
EmptyUtils
.
isStrNotEmpty
(
state
.
filterMotherNo
))
{
state
.
isFilter
=
false
;
queryFirstPage
();
}
else
{
state
.
isFilter
=
true
;
state
.
dataList
=
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
state
.
dataList
=
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
filter
()
.
filter
()
.
optional
(
EmptyUtils
.
isStrNotEmpty
(
state
.
filterHighNo
),
(
q
)
=>
q
.
registrationNoEqualTo
(
state
.
filterHighNo
))
.
optional
(
EmptyUtils
.
isStrNotEmpty
(
state
.
filterHighNo
),
(
q
)
=>
q
.
registrationNoEqualTo
(
state
.
filterHighNo
))
...
@@ -30,15 +33,43 @@ class CattleResumeListLogic extends GetxController {
...
@@ -30,15 +33,43 @@ class CattleResumeListLogic extends GetxController {
.
optional
(
EmptyUtils
.
isStrNotEmpty
(
state
.
filterMotherNo
),
(
q
)
=>
q
.
motherRegEqualTo
(
state
.
filterMotherNo
))
.
optional
(
EmptyUtils
.
isStrNotEmpty
(
state
.
filterMotherNo
),
(
q
)
=>
q
.
motherRegEqualTo
(
state
.
filterMotherNo
))
.
findAll
();
.
findAll
();
}
}
isShow
=
false
;
isShow
=
false
;
getItemList
(
state
.
dataList
);
getItemList
(
state
.
dataList
);
}
}
queryAll
()
async
{
queryFirstPage
()
{
state
.
dataList
=
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
filter
().
unidIsNotEmpty
().
findAll
();
state
.
isFilter
=
false
;
state
.
dataList
.
clear
();
state
.
pagination
=
1
;
queryOnePage
();
}
queryOnePage
()
async
{
var
pageData
=
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
filter
()
.
unidIsNotEmpty
()
.
offset
(
state
.
pageCount
*
(
state
.
pagination
-
1
))
.
limit
(
state
.
pageCount
)
.
findAll
();
if
(
pageData
.
isEmpty
)
{
state
.
pagination
--;
}
state
.
dataList
.
addAll
(
pageData
);
getItemList
(
state
.
dataList
);
getItemList
(
state
.
dataList
);
}
}
onRefresh
()
{
state
.
dataList
.
clear
();
queryOnePage
();
}
onLoad
()
{
if
(!
state
.
isFilter
)
{
state
.
pagination
++;
queryOnePage
();
}
}
clean
()
{
clean
()
{
state
.
filterHighNo
=
''
;
state
.
filterHighNo
=
''
;
state
.
filterVisualNo
=
''
;
state
.
filterVisualNo
=
''
;
...
...
lib/pages/cattle_resume/cattle_resume_list/cattle_resume_list_state.dart
View file @
23c8f3b0
...
@@ -8,11 +8,16 @@ class CattleResumeListState {
...
@@ -8,11 +8,16 @@ class CattleResumeListState {
late
List
<
CattleResumeEntity
>
dataList
;
late
List
<
CattleResumeEntity
>
dataList
;
late
List
<
Widget
>
items
;
late
List
<
Widget
>
items
;
int
pageCount
=
10
;
int
pagination
=
1
;
String
filterHighNo
=
''
;
String
filterHighNo
=
''
;
String
filterVisualNo
=
''
;
String
filterVisualNo
=
''
;
String
filterFatherNo
=
''
;
String
filterFatherNo
=
''
;
String
filterMotherNo
=
''
;
String
filterMotherNo
=
''
;
bool
isFilter
=
false
;
CattleResumeListState
()
{
CattleResumeListState
()
{
items
=
[];
items
=
[];
dataList
=
[
dataList
=
[
...
...
lib/pages/cattle_resume/cattle_resume_list/cattle_resume_list_view.dart
View file @
23c8f3b0
This diff is collapsed.
Click to expand it.
lib/pages/cattle_resume/cattle_resume_logic.dart
View file @
23c8f3b0
...
@@ -105,7 +105,7 @@ class CattleResumeLogic extends GetxController {
...
@@ -105,7 +105,7 @@ class CattleResumeLogic extends GetxController {
DialogUtils
.
showToast
(
'必须填写可视耳标'
);
DialogUtils
.
showToast
(
'必须填写可视耳标'
);
return
true
;
return
true
;
}
}
if
(!
EmptyUtils
.
isStrNotEmpty
(
state
.
entity
.
photoPath
))
{
if
(!
EmptyUtils
.
isStrNotEmpty
(
state
.
entity
.
photoPath
)
&&!
EmptyUtils
.
isStrNotEmpty
(
state
.
photoPath
)
)
{
DialogUtils
.
showToast
(
'必须上传牛只拍照'
);
DialogUtils
.
showToast
(
'必须上传牛只拍照'
);
return
true
;
return
true
;
}
}
...
...
lib/pages/cattle_resume/cattle_resume_view.dart
View file @
23c8f3b0
...
@@ -8,6 +8,7 @@ import 'package:get/get.dart';
...
@@ -8,6 +8,7 @@ import 'package:get/get.dart';
import
'../../congifs.dart'
;
import
'../../congifs.dart'
;
import
'../../routes/routes.dart'
;
import
'../../routes/routes.dart'
;
import
'../../utils/empty_utils.dart'
;
import
'../../utils/empty_utils.dart'
;
import
'../../widget/NullDataView.dart'
;
import
'cattle_resume_logic.dart'
;
import
'cattle_resume_logic.dart'
;
import
'package:flutter_speed_dial/flutter_speed_dial.dart'
;
import
'package:flutter_speed_dial/flutter_speed_dial.dart'
;
...
@@ -22,6 +23,7 @@ class CattleResumePage extends StatelessWidget {
...
@@ -22,6 +23,7 @@ class CattleResumePage extends StatelessWidget {
return
Scaffold
(
return
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
title:
const
Text
(
'基础信息'
),
title:
const
Text
(
'基础信息'
),
backgroundColor:
Colors
.
blue
,
centerTitle:
true
,
centerTitle:
true
,
),
),
body:
Column
(
body:
Column
(
...
@@ -35,10 +37,12 @@ class CattleResumePage extends StatelessWidget {
...
@@ -35,10 +37,12 @@ class CattleResumePage extends StatelessWidget {
InkWell
(
InkWell
(
child:
AspectRatio
(
child:
AspectRatio
(
aspectRatio:
1.0
/
1.0
,
aspectRatio:
1.0
/
1.0
,
child:
Image
.
file
(
child:
EmptyUtils
.
isStrNotEmpty
(
state
.
photoPath
)
File
(
state
.
photoPath
??
''
),
?
Image
.
file
(
fit:
BoxFit
.
contain
,
File
(
state
.
photoPath
??
''
),
),
fit:
BoxFit
.
contain
,
)
:
const
NullDataView
(),
),
),
onTap:
()
async
{
onTap:
()
async
{
var
photoPath
=
await
Get
.
toNamed
(
AppRoute
.
CAMERA
,
arguments:
state
.
unid
);
var
photoPath
=
await
Get
.
toNamed
(
AppRoute
.
CAMERA
,
arguments:
state
.
unid
);
...
@@ -97,17 +101,20 @@ class CattleResumePage extends StatelessWidget {
...
@@ -97,17 +101,20 @@ class CattleResumePage extends StatelessWidget {
logic
.
update
(),
logic
.
update
(),
}),
}),
}),
}),
getItemView
(
'出生日期'
,
state
.
entity
.
birthdate
??
''
,
()
=>
{
getItemView
(
DialogUtils
.
showTimeDialog
(
'出生日期'
,
context
,
state
.
entity
.
birthdate
??
''
,
isTime:
true
,
()
=>
{
title:
'请选择出生日期'
,
DialogUtils
.
showTimeDialog
(
onPositive:
(
date
)=>{
context
,
state
.
entity
.
birthdate
=
date
,
isTime:
false
,
logic
.
update
(),
title:
'请选择出生日期'
,
},
onPositive:
(
date
)
=>
{
),
state
.
entity
.
birthdate
=
date
,
}),
logic
.
update
(),
},
),
}),
const
SizedBox
(
const
SizedBox
(
width:
10
,
width:
10
,
),
),
...
@@ -364,73 +371,76 @@ class CattleResumePage extends StatelessWidget {
...
@@ -364,73 +371,76 @@ class CattleResumePage extends StatelessWidget {
],
],
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation
.
endFloat
,
floatingActionButtonLocation:
FloatingActionButtonLocation
.
endFloat
,
floatingActionButton:
SpeedDial
(
floatingActionButton:
Padding
(
icon:
Icons
.
add
,
padding:
const
EdgeInsets
.
only
(
right:
20.0
,
bottom:
80.0
),
activeIcon:
Icons
.
close
,
child:
SpeedDial
(
spacing:
3
,
icon:
Icons
.
add
,
// openCloseDial: ValueNotifier.value,
activeIcon:
Icons
.
close
,
childPadding:
const
EdgeInsets
.
all
(
5
),
spacing:
3
,
buttonSize:
const
Size
(
40
,
40
),
// openCloseDial: ValueNotifier.value,
elevation:
8.0
,
childPadding:
const
EdgeInsets
.
all
(
5
),
children:
[
buttonSize:
const
Size
(
40
,
40
),
SpeedDialChild
(
elevation:
8.0
,
child:
const
Icon
(
IconFont
.
cattle_resume
),
children:
[
backgroundColor:
Colors
.
black
,
SpeedDialChild
(
foregroundColor:
Colors
.
white
,
child:
const
Icon
(
IconFont
.
cattle_resume
),
label:
'基础信息'
,
backgroundColor:
Colors
.
black
,
onTap:
()
{
foregroundColor:
Colors
.
white
,
DialogUtils
.
showToast
(
'toast...'
);
label:
'基础信息'
,
},
onTap:
()
{
onLongPress:
()
=>
debugPrint
(
'FIRST CHILD LONG PRESS'
),
DialogUtils
.
showToast
(
'toast...'
);
),
},
SpeedDialChild
(
onLongPress:
()
=>
debugPrint
(
'FIRST CHILD LONG PRESS'
),
child:
const
Icon
(
IconFont
.
performance
),
),
backgroundColor:
const
Color
.
fromARGB
(
255
,
104
,
152
,
218
),
SpeedDialChild
(
foregroundColor:
Colors
.
white
,
child:
const
Icon
(
IconFont
.
performance
),
label:
'性能测定'
,
backgroundColor:
const
Color
.
fromARGB
(
255
,
104
,
152
,
218
),
onTap:
()
=>
{
foregroundColor:
Colors
.
white
,
DialogUtils
.
showLoadingDialog
(
'加载中...'
),
label:
'性能测定'
,
},
onTap:
()
=>
{
),
DialogUtils
.
showLoadingDialog
(
'加载中...'
),
SpeedDialChild
(
},
child:
const
Icon
(
IconFont
.
medical_record
),
),
backgroundColor:
const
Color
.
fromARGB
(
255
,
220
,
128
,
70
),
SpeedDialChild
(
foregroundColor:
Colors
.
white
,
child:
const
Icon
(
IconFont
.
medical_record
),
label:
'诊疗记录'
,
backgroundColor:
const
Color
.
fromARGB
(
255
,
220
,
128
,
70
),
visible:
true
,
foregroundColor:
Colors
.
white
,
onTap:
()
=>
DialogUtils
.
showInputDialog
(
onPositive:
(
inputStr
)
{
label:
'诊疗记录'
,
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
SnackBar
(
content:
Text
(
inputStr
)));
visible:
true
,
}),
onTap:
()
=>
DialogUtils
.
showInputDialog
(
onPositive:
(
inputStr
)
{
onLongPress:
()
=>
debugPrint
(
'THIRD CHILD LONG PRESS'
),
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
SnackBar
(
content:
Text
(
inputStr
)));
),
}),
SpeedDialChild
(
onLongPress:
()
=>
debugPrint
(
'THIRD CHILD LONG PRESS'
),
child:
const
Icon
(
IconFont
.
breeding_record
),
),
backgroundColor:
const
Color
.
fromARGB
(
255
,
210
,
76
,
154
),
SpeedDialChild
(
foregroundColor:
Colors
.
white
,
child:
const
Icon
(
IconFont
.
breeding_record
),
label:
'配种记录'
,
backgroundColor:
const
Color
.
fromARGB
(
255
,
210
,
76
,
154
),
onTap:
()
=>
{
DialogUtils
.
showWarningDialog
(
'配种记录!!'
)},
foregroundColor:
Colors
.
white
,
onLongPress:
()
=>
debugPrint
(
'FIRST CHILD LONG PRESS'
),
label:
'配种记录'
,
),
onTap:
()
=>
{
DialogUtils
.
showWarningDialog
(
'配种记录!!'
)},
SpeedDialChild
(
onLongPress:
()
=>
debugPrint
(
'FIRST CHILD LONG PRESS'
),
child:
const
Icon
(
IconFont
.
immune
),
),
backgroundColor:
const
Color
.
fromARGB
(
255
,
116
,
154
,
110
),
SpeedDialChild
(
foregroundColor:
Colors
.
white
,
child:
const
Icon
(
IconFont
.
immune
),
label:
'免疫记录'
,
backgroundColor:
const
Color
.
fromARGB
(
255
,
116
,
154
,
110
),
onTap:
()
=>
{},
foregroundColor:
Colors
.
white
,
),
label:
'免疫记录'
,
SpeedDialChild
(
onTap:
()
=>
{},
child:
const
Icon
(
IconFont
.
weight
),
),
backgroundColor:
const
Color
.
fromARGB
(
255
,
150
,
114
,
89
),
SpeedDialChild
(
foregroundColor:
Colors
.
white
,
child:
const
Icon
(
IconFont
.
weight
),
label:
'称重记录'
,
backgroundColor:
const
Color
.
fromARGB
(
255
,
150
,
114
,
89
),
visible:
true
,
foregroundColor:
Colors
.
white
,
onTap:
()
=>
label:
'称重记录'
,
DialogUtils
.
showMultipleListDialog
([
'aaa'
,
'bbb'
,
'ccc'
],
[
'111'
,
'222'
,
'333'
],
onPositive:
(
result
)
{
visible:
true
,
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
SnackBar
(
content:
Text
(
result
)));
onTap:
()
=>
}),
DialogUtils
.
showMultipleListDialog
([
'aaa'
,
'bbb'
,
'ccc'
],
[
'111'
,
'222'
,
'333'
],
onPositive:
(
result
)
{
// onLongPress: () => ,
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
SnackBar
(
content:
Text
(
result
)));
),
}),
],
// onLongPress: () => ,
),
],
),
),
),
);
);
}
}
...
...
lib/pages/home/home_logic.dart
View file @
23c8f3b0
...
@@ -24,6 +24,7 @@ class HomeLogic extends GetxController {
...
@@ -24,6 +24,7 @@ class HomeLogic extends GetxController {
//
//
// update();
// update();
}
}
///获取游客令牌
///获取游客令牌
void
getVisitorToken
()
async
{
void
getVisitorToken
()
async
{
...
@@ -35,7 +36,6 @@ class HomeLogic extends GetxController {
...
@@ -35,7 +36,6 @@ class HomeLogic extends GetxController {
Map
<
String
,
String
>
map
=
{};
//参数
Map
<
String
,
String
>
map
=
{};
//参数
String
strMd5
=
''
;
String
strMd5
=
''
;
map
.
putIfAbsent
(
'code'
,
()
=>
''
);
map
.
putIfAbsent
(
'code'
,
()
=>
''
);
map
.
putIfAbsent
(
'userType'
,
()
=>
'Tourist'
);
map
.
putIfAbsent
(
'userType'
,
()
=>
'Tourist'
);
String
apiKey
=
'kangeqiu@8868!'
;
String
apiKey
=
'kangeqiu@8868!'
;
...
@@ -56,16 +56,13 @@ class HomeLogic extends GetxController {
...
@@ -56,16 +56,13 @@ class HomeLogic extends GetxController {
// return true; //false 表示没有处理移除 ture 表示处理了异常 默认值 false
// return true; //false 表示没有处理移除 ture 表示处理了异常 默认值 false
// }
// }
// );
// );
}
}
getBreedingCount
()
async
{
getBreedingCount
()
async
{
breedingCount
.
value
=
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
count
();
breedingCount
.
value
=
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
filter
().
statusEqualTo
(
'1'
).
count
();
// breedingCount.value = 650;
obsoleteCount
.
value
=
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
filter
().
statusEqualTo
(
'2'
).
count
();
obsoleteCount
.
value
=
await
GlobalService
.
to
.
isar
.
dictEntitys
.
count
();
deadCount
.
value
=
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
filter
().
statusEqualTo
(
'3'
).
count
();
deadCount
.
value
=
4
;
sellCount
.
value
=
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
filter
().
statusEqualTo
(
'4'
).
count
();
sellCount
.
value
=
8
;
}
}
forWard
(
String
title
)
{
forWard
(
String
title
)
{
...
@@ -90,6 +87,5 @@ class HomeLogic extends GetxController {
...
@@ -90,6 +87,5 @@ class HomeLogic extends GetxController {
void
onInit
()
{
void
onInit
()
{
getBreedingCount
();
getBreedingCount
();
// update();
// update();
}
}
}
}
lib/pages/home/home_view.dart
View file @
23c8f3b0
...
@@ -31,7 +31,11 @@ class HomePage extends StatelessWidget {
...
@@ -31,7 +31,11 @@ class HomePage extends StatelessWidget {
child:
Column
(
child:
Column
(
children:
[
children:
[
//banner
//banner
Image
.
asset
(
'images/banner.png'
),
Image
.
asset
(
'images/banner.png'
,
height:
200
,
fit:
BoxFit
.
cover
,
),
//牛只数量
//牛只数量
Row
(
Row
(
children:
[
children:
[
...
@@ -39,15 +43,13 @@ class HomePage extends StatelessWidget {
...
@@ -39,15 +43,13 @@ class HomePage extends StatelessWidget {
width:
8
,
width:
8
,
),
),
Obx
(()
{
Obx
(()
{
return
_getCountItem
(
'images/1.png'
,
'养殖中'
,
return
_getCountItem
(
'images/1.png'
,
'养殖中'
,
logic
.
breedingCount
.
value
,
IconFont
.
breeding_count
);
logic
.
breedingCount
.
value
,
IconFont
.
breeding_count
);
}),
}),
const
SizedBox
(
const
SizedBox
(
width:
8
,
width:
8
,
),
),
Obx
(()
{
Obx
(()
{
return
_getCountItem
(
'images/2.png'
,
'已淘汰'
,
return
_getCountItem
(
'images/2.png'
,
'已淘汰'
,
logic
.
obsoleteCount
.
value
,
IconFont
.
obsolete_count
);
logic
.
obsoleteCount
.
value
,
IconFont
.
obsolete_count
);
}),
}),
const
SizedBox
(
const
SizedBox
(
width:
8
,
width:
8
,
...
@@ -60,8 +62,7 @@ class HomePage extends StatelessWidget {
...
@@ -60,8 +62,7 @@ class HomePage extends StatelessWidget {
width:
8
,
width:
8
,
),
),
Obx
(()
{
Obx
(()
{
return
_getCountItem
(
'images/3.png'
,
'已死亡'
,
return
_getCountItem
(
'images/3.png'
,
'已死亡'
,
logic
.
deadCount
.
value
,
IconFont
.
dead_count
);
logic
.
deadCount
.
value
,
IconFont
.
dead_count
);
}),
}),
const
SizedBox
(
const
SizedBox
(
width:
8
,
width:
8
,
...
@@ -104,13 +105,11 @@ class HomePage extends StatelessWidget {
...
@@ -104,13 +105,11 @@ class HomePage extends StatelessWidget {
const
SizedBox
(
const
SizedBox
(
width:
8
,
width:
8
,
),
),
_getFunButton
(
'性能测定'
,
IconFont
.
performance
,
_getFunButton
(
'性能测定'
,
IconFont
.
performance
,
const
Color
.
fromARGB
(
255
,
104
,
152
,
218
)),
const
Color
.
fromARGB
(
255
,
104
,
152
,
218
)),
const
SizedBox
(
const
SizedBox
(
width:
8
,
width:
8
,
),
),
_getFunButton
(
'诊疗记录'
,
IconFont
.
medical_record
,
_getFunButton
(
'诊疗记录'
,
IconFont
.
medical_record
,
const
Color
.
fromARGB
(
255
,
220
,
128
,
70
)),
const
Color
.
fromARGB
(
255
,
220
,
128
,
70
)),
const
SizedBox
(
const
SizedBox
(
width:
8
,
width:
8
,
),
),
...
@@ -122,18 +121,15 @@ class HomePage extends StatelessWidget {
...
@@ -122,18 +121,15 @@ class HomePage extends StatelessWidget {
const
SizedBox
(
const
SizedBox
(
width:
8
,
width:
8
,
),
),
_getFunButton
(
'配种记录'
,
IconFont
.
breeding_record
,
_getFunButton
(
'配种记录'
,
IconFont
.
breeding_record
,
const
Color
.
fromARGB
(
255
,
210
,
76
,
154
)),
const
Color
.
fromARGB
(
255
,
210
,
76
,
154
)),
const
SizedBox
(
const
SizedBox
(
width:
8
,
width:
8
,
),
),
_getFunButton
(
'免疫记录'
,
IconFont
.
immune
,
_getFunButton
(
'免疫记录'
,
IconFont
.
immune
,
const
Color
.
fromARGB
(
255
,
116
,
154
,
110
)),
const
Color
.
fromARGB
(
255
,
116
,
154
,
110
)),
const
SizedBox
(
const
SizedBox
(
width:
8
,
width:
8
,
),
),
_getFunButton
(
'称重管理'
,
IconFont
.
weight
,
_getFunButton
(
'称重管理'
,
IconFont
.
weight
,
const
Color
.
fromARGB
(
255
,
150
,
114
,
89
)),
const
Color
.
fromARGB
(
255
,
150
,
114
,
89
)),
const
SizedBox
(
const
SizedBox
(
width:
8
,
width:
8
,
),
),
...
@@ -147,8 +143,7 @@ class HomePage extends StatelessWidget {
...
@@ -147,8 +143,7 @@ class HomePage extends StatelessWidget {
}
}
///banner下方的牛只数量统计
///banner下方的牛只数量统计
Expanded
_getCountItem
(
Expanded
_getCountItem
(
String
imagePath
,
String
title
,
int
count
,
IconData
iconData
)
{
String
imagePath
,
String
title
,
int
count
,
IconData
iconData
)
{
return
Expanded
(
return
Expanded
(
child:
InkWell
(
child:
InkWell
(
onTap:
()
=>
{},
onTap:
()
=>
{},
...
...
lib/pages/login/login_logic.dart
View file @
23c8f3b0
...
@@ -22,6 +22,8 @@ class LoginLogic extends GetxController {
...
@@ -22,6 +22,8 @@ class LoginLogic extends GetxController {
RxString
versionStr
=
'1.0.0'
.
obs
;
RxString
versionStr
=
'1.0.0'
.
obs
;
RxBool
isObscure
=
true
.
obs
;
int
appId
=
0
;
int
appId
=
0
;
LoginLogic
()
{
LoginLogic
()
{
...
@@ -79,7 +81,8 @@ class LoginLogic extends GetxController {
...
@@ -79,7 +81,8 @@ class LoginLogic extends GetxController {
getDictList
();
getDictList
();
})
})
..
onError
((
msg
,
code
)
{
..
onError
((
msg
,
code
)
{
DialogUtils
.
showWarningDialog
(
'登录失败:
$msg
'
);
// DialogUtils.showWarningDialog('登录失败:$msg');
DialogUtils
.
showToast
(
'登录失败'
);
return
;
return
;
})
})
..
build
();
..
build
();
...
@@ -135,7 +138,6 @@ class LoginLogic extends GetxController {
...
@@ -135,7 +138,6 @@ class LoginLogic extends GetxController {
HttpUtils
<
int
>()
HttpUtils
<
int
>()
..
get
()
..
get
()
..
setUrl
(
APIS
.
get_version
)
..
setUrl
(
APIS
.
get_version
)
..
showLoading
()
..
onResponse
((
response
)
{
..
onResponse
((
response
)
{
if
(
buildNumber
!=
response
.
toString
())
{
if
(
buildNumber
!=
response
.
toString
())
{
// DialogUtils.showToast('最新版本$response');
// DialogUtils.showToast('最新版本$response');
...
@@ -148,8 +150,7 @@ class LoginLogic extends GetxController {
...
@@ -148,8 +150,7 @@ class LoginLogic extends GetxController {
// var _packageName = packageInfo.packageName;
// var _packageName = packageInfo.packageName;
})
})
..
onError
((
msg
,
code
)
{
..
onError
((
msg
,
code
)
{
DialogUtils
.
dismissDialog
();
// DialogUtils.dismissDialog();
DialogUtils
.
showWarningDialog
(
''
);
})
})
..
build
();
..
build
();
}
}
...
@@ -157,7 +158,7 @@ class LoginLogic extends GetxController {
...
@@ -157,7 +158,7 @@ class LoginLogic extends GetxController {
///下载app
///下载app
void
upgrade
()
async
{
void
upgrade
()
async
{
appId
=
await
RUpgrade
.
upgrade
(
appId
=
await
RUpgrade
.
upgrade
(
'
${APIS.baseUrl}
/api/download?type=
APP
'
,
'
${APIS.baseUrl}
/api/download?type=
Flutter
'
,
fileName:
'anchor_collect_flutter.apk'
,
fileName:
'anchor_collect_flutter.apk'
,
installType:
RUpgradeInstallType
.
normal
,
installType:
RUpgradeInstallType
.
normal
,
)
??
)
??
...
...
lib/pages/login/login_view.dart
View file @
23c8f3b0
...
@@ -63,7 +63,9 @@ class LoginPage extends StatelessWidget {
...
@@ -63,7 +63,9 @@ class LoginPage extends StatelessWidget {
contentPadding:
EdgeInsets
.
symmetric
(
horizontal:
10.0
,
vertical:
15.0
),
contentPadding:
EdgeInsets
.
symmetric
(
horizontal:
10.0
,
vertical:
15.0
),
suffixIcon:
IconButton
(
suffixIcon:
IconButton
(
icon:
ImageIcon
(
AssetImage
(
'images/ic_delete.png'
)),
icon:
ImageIcon
(
AssetImage
(
'images/ic_delete.png'
)),
onPressed:
()
{},
onPressed:
()
{
logic
.
nameController
.
text
=
''
;
},
),
),
),
),
controller:
logic
.
nameController
,
controller:
logic
.
nameController
,
...
@@ -71,22 +73,26 @@ class LoginPage extends StatelessWidget {
...
@@ -71,22 +73,26 @@ class LoginPage extends StatelessWidget {
const
SizedBox
(
const
SizedBox
(
height:
20
,
height:
20
,
),
),
TextField
(
Obx
(()
{
obscureText:
true
,
return
TextField
(
textInputAction:
TextInputAction
.
send
,
obscureText:
logic
.
isObscure
.
value
,
decoration:
InputDecoration
(
textInputAction:
TextInputAction
.
send
,
hintText:
'请输入您的密码'
,
decoration:
InputDecoration
(
border:
OutlineInputBorder
(),
hintText:
'请输入您的密码'
,
filled:
true
,
border:
OutlineInputBorder
(),
fillColor:
Colors
.
white
,
filled:
true
,
contentPadding:
EdgeInsets
.
symmetric
(
horizontal:
10.0
,
vertical:
15.0
),
fillColor:
Colors
.
white
,
suffixIcon:
IconButton
(
contentPadding:
EdgeInsets
.
symmetric
(
horizontal:
10.0
,
vertical:
15.0
),
icon:
ImageIcon
(
AssetImage
(
'images/ic_eye_open.png'
)),
suffixIcon:
IconButton
(
onPressed:
()
{},
icon:
ImageIcon
(
AssetImage
(
'images/ic_eye_open.png'
)),
onPressed:
()
{
logic
.
isObscure
.
value
=
!
logic
.
isObscure
.
value
;
},
),
),
),
)
,
controller:
logic
.
passwordController
,
controller:
logic
.
passwordController
,
);
),
}
),
const
SizedBox
(
const
SizedBox
(
height:
15
,
height:
15
,
),
),
...
...
lib/pages/main/main_view.dart
View file @
23c8f3b0
import
'package:anchor_collect_flutter/pages/home/home_logic.dart'
;
import
'package:anchor_collect_flutter/pages/home/home_view.dart'
;
import
'package:anchor_collect_flutter/pages/home/home_view.dart'
;
import
'package:anchor_collect_flutter/pages/message/message_view.dart'
;
import
'package:anchor_collect_flutter/pages/message/message_view.dart'
;
import
'package:anchor_collect_flutter/pages/mine/mine_view.dart'
;
import
'package:anchor_collect_flutter/pages/mine/mine_view.dart'
;
...
@@ -13,8 +14,9 @@ import 'main_logic.dart';
...
@@ -13,8 +14,9 @@ import 'main_logic.dart';
class
MainPage
extends
StatelessWidget
{
class
MainPage
extends
StatelessWidget
{
final
logic
=
Get
.
find
<
MainLogic
>();
final
logic
=
Get
.
find
<
MainLogic
>();
final
state
=
Get
.
find
<
MainLogic
>().
state
;
final
state
=
Get
.
find
<
MainLogic
>().
state
;
final
syncLogic
=
Get
.
find
<
Sync
Logic
>();
final
homeLogic
=
Get
.
find
<
Home
Logic
>();
final
messageLogic
=
Get
.
find
<
MessageLogic
>();
final
messageLogic
=
Get
.
find
<
MessageLogic
>();
final
syncLogic
=
Get
.
find
<
SyncLogic
>();
static
final
List
<
Widget
>
_pageList
=
[
static
final
List
<
Widget
>
_pageList
=
[
HomePage
(),
HomePage
(),
MessagePage
(),
MessagePage
(),
...
@@ -62,6 +64,9 @@ class MainPage extends StatelessWidget {
...
@@ -62,6 +64,9 @@ class MainPage extends StatelessWidget {
],
],
onTap:
(
int
position
)
{
onTap:
(
int
position
)
{
switch
(
position
){
switch
(
position
){
case
0
:
homeLogic
.
getBreedingCount
();
break
;
case
1
:
case
1
:
messageLogic
.
getMessageCount
();
messageLogic
.
getMessageCount
();
break
;
break
;
...
...
lib/pages/message/message_detail/message_detail_view.dart
View file @
23c8f3b0
...
@@ -13,6 +13,7 @@ class MessageDetailPage extends StatelessWidget {
...
@@ -13,6 +13,7 @@ class MessageDetailPage extends StatelessWidget {
return
Scaffold
(
return
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
title:
const
Text
(
'消息详情'
),
title:
const
Text
(
'消息详情'
),
backgroundColor:
Colors
.
blue
,
centerTitle:
true
,
centerTitle:
true
,
),
),
body:
Padding
(
body:
Padding
(
...
...
lib/pages/message/message_list/message_list_view.dart
View file @
23c8f3b0
...
@@ -15,6 +15,7 @@ class MessageListPage extends StatelessWidget {
...
@@ -15,6 +15,7 @@ class MessageListPage extends StatelessWidget {
return
Scaffold
(
return
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
title:
const
Text
(
'消息列表'
),
title:
const
Text
(
'消息列表'
),
backgroundColor:
Colors
.
blue
,
centerTitle:
true
,
centerTitle:
true
,
),
),
body:
GetBuilder
<
MessageListLogic
>(
builder:
(
logic
)
{
body:
GetBuilder
<
MessageListLogic
>(
builder:
(
logic
)
{
...
...
lib/pages/message/message_view.dart
View file @
23c8f3b0
...
@@ -15,6 +15,7 @@ class MessagePage extends StatelessWidget {
...
@@ -15,6 +15,7 @@ class MessagePage extends StatelessWidget {
return
Scaffold
(
return
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
title:
const
Text
(
'生产提醒'
),
title:
const
Text
(
'生产提醒'
),
backgroundColor:
Colors
.
blue
,
centerTitle:
true
,
centerTitle:
true
,
),
),
body:
GetBuilder
<
MessageLogic
>(
builder:
(
logic
)
{
body:
GetBuilder
<
MessageLogic
>(
builder:
(
logic
)
{
...
@@ -25,7 +26,7 @@ class MessagePage extends StatelessWidget {
...
@@ -25,7 +26,7 @@ class MessagePage extends StatelessWidget {
crossAxisSpacing:
8
,
// 横轴上Item间距
crossAxisSpacing:
8
,
// 横轴上Item间距
mainAxisSpacing:
8
,
// 主轴上Item间距
mainAxisSpacing:
8
,
// 主轴上Item间距
// mainAxisExtent: 100, // 主轴上Item长度
// mainAxisExtent: 100, // 主轴上Item长度
childAspectRatio:
1.
5
,
// 横轴长度/主轴长度
childAspectRatio:
1.
2
,
// 横轴长度/主轴长度
),
),
itemCount:
state
.
items
.
length
,
itemCount:
state
.
items
.
length
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
itemBuilder:
(
BuildContext
context
,
int
index
)
{
...
...
lib/pages/mine/mine_view.dart
View file @
23c8f3b0
...
@@ -11,6 +11,98 @@ class MinePage extends StatelessWidget {
...
@@ -11,6 +11,98 @@ class MinePage extends StatelessWidget {
final
logic
=
Get
.
find
<
MineLogic
>();
final
logic
=
Get
.
find
<
MineLogic
>();
final
state
=
Get
.
find
<
MineLogic
>().
state
;
final
state
=
Get
.
find
<
MineLogic
>().
state
;
return
Container
();
return
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'我的'
),
centerTitle:
true
,
backgroundColor:
Colors
.
blue
,
),
body:
Stack
(
children:
[
///下层背景
Column
(
mainAxisSize:
MainAxisSize
.
max
,
children:
[
Container
(
width:
double
.
infinity
,
height:
300
,
color:
Colors
.
blue
,
),
Expanded
(
child:
Container
(
width:
double
.
infinity
,
color:
Colors
.
grey
,
),
),
],
),
///上层
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
mainAxisSize:
MainAxisSize
.
max
,
children:
[
Row
(
children:
[
CircleAvatar
(
radius:
50
,
// 头像的半径大小
backgroundImage:
AssetImage
(
'assets/images/ic_launcher.png'
),
// 头像的图片路径
),
Text
(
'用户名'
),
Expanded
(
child:
SizedBox
()),
Text
(
'个人信息>'
),
],
),
Container
(
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
8
),
),
child:
const
Column
(
children:
[
ListTile
(
title:
Text
(
'编辑资料'
),
leading:
Icon
(
Icons
.
account_box
),
trailing:
Icon
(
Icons
.
add
),
),
ListTile
(
title:
Text
(
'关于我们'
),
leading:
Icon
(
Icons
.
accessibility
),
trailing:
Icon
(
Icons
.
add
),
),
ListTile
(
title:
Text
(
'修改密码'
),
leading:
Icon
(
Icons
.
account_balance_wallet_outlined
),
trailing:
Icon
(
Icons
.
add
),
),
ListTile
(
title:
Text
(
'检查更新'
),
leading:
Icon
(
Icons
.
ad_units_outlined
),
trailing:
Icon
(
Icons
.
add
),
),
],
),
),
const
SizedBox
(
height:
100
,
),
Row
(
children:
[
Expanded
(
child:
TextButton
(
style:
ButtonStyle
(
backgroundColor:
MaterialStateProperty
.
all
(
Colors
.
blue
),
foregroundColor:
MaterialStateProperty
.
all
(
Colors
.
white
),
padding:
MaterialStateProperty
.
all
(
const
EdgeInsets
.
all
(
8
)),
),
onPressed:
()
=>
(),
child:
const
Text
(
"退出登录"
),
),
),
]),
],
),
],
),
);
}
}
}
}
lib/pages/performance/performance_binding.dart
0 → 100644
View file @
23c8f3b0
import
'package:get/get.dart'
;
import
'performance_logic.dart'
;
class
PerformanceBinding
extends
Bindings
{
@override
void
dependencies
()
{
Get
.
lazyPut
(()
=>
PerformanceLogic
());
}
}
lib/pages/performance/performance_list/performance_list_binding.dart
0 → 100644
View file @
23c8f3b0
import
'package:get/get.dart'
;
import
'performance_list_logic.dart'
;
class
PerformanceListBinding
extends
Bindings
{
@override
void
dependencies
()
{
Get
.
lazyPut
(()
=>
PerformanceListLogic
());
}
}
lib/pages/performance/performance_list/performance_list_logic.dart
0 → 100644
View file @
23c8f3b0
import
'package:get/get.dart'
;
import
'performance_list_state.dart'
;
class
PerformanceListLogic
extends
GetxController
{
final
PerformanceListState
state
=
PerformanceListState
();
}
lib/pages/performance/performance_list/performance_list_state.dart
0 → 100644
View file @
23c8f3b0
class
PerformanceListState
{
PerformanceListState
()
{
///Initialize variables
}
}
lib/pages/performance/performance_list/performance_list_view.dart
0 → 100644
View file @
23c8f3b0
import
'package:flutter/material.dart'
;
import
'package:get/get.dart'
;
import
'performance_list_logic.dart'
;
class
PerformanceListPage
extends
StatelessWidget
{
const
PerformanceListPage
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
final
logic
=
Get
.
find
<
PerformanceListLogic
>();
final
state
=
Get
.
find
<
PerformanceListLogic
>().
state
;
return
Container
();
}
}
lib/pages/performance/performance_logic.dart
0 → 100644
View file @
23c8f3b0
import
'package:get/get.dart'
;
import
'performance_state.dart'
;
class
PerformanceLogic
extends
GetxController
{
final
PerformanceState
state
=
PerformanceState
();
}
lib/pages/performance/performance_state.dart
0 → 100644
View file @
23c8f3b0
class
PerformanceState
{
PerformanceState
()
{
///Initialize variables
}
}
lib/pages/performance/performance_view.dart
0 → 100644
View file @
23c8f3b0
import
'package:flutter/material.dart'
;
import
'package:get/get.dart'
;
import
'performance_logic.dart'
;
class
PerformancePage
extends
StatelessWidget
{
const
PerformancePage
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
final
logic
=
Get
.
find
<
PerformanceLogic
>();
final
state
=
Get
.
find
<
PerformanceLogic
>().
state
;
return
Container
();
}
}
lib/pages/setting/setting_view.dart
View file @
23c8f3b0
...
@@ -17,6 +17,7 @@ class SettingPage extends StatelessWidget {
...
@@ -17,6 +17,7 @@ class SettingPage extends StatelessWidget {
return
Scaffold
(
return
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
title:
const
Text
(
'设置'
),
title:
const
Text
(
'设置'
),
backgroundColor:
Colors
.
blue
,
centerTitle:
true
,
centerTitle:
true
,
),
),
body:
Center
(
body:
Center
(
...
...
lib/pages/sync/sync_logic.dart
View file @
23c8f3b0
import
'package:anchor_collect_flutter/api/HttpUtils.dart'
;
import
'package:anchor_collect_flutter/api/HttpUtils.dart'
;
import
'package:anchor_collect_flutter/congifs.dart'
;
import
'package:anchor_collect_flutter/congifs.dart'
;
import
'package:anchor_collect_flutter/controllers/global_service.dart'
;
import
'package:anchor_collect_flutter/controllers/global_service.dart'
;
...
@@ -24,13 +23,41 @@ class SyncLogic extends GetxController {
...
@@ -24,13 +23,41 @@ class SyncLogic extends GetxController {
list
.
add
(
ListTile
(
list
.
add
(
ListTile
(
title:
Text
(
state
.
dataList
[
i
].
title
),
title:
Text
(
state
.
dataList
[
i
].
title
),
subtitle:
GetBuilder
<
SyncLogic
>(
builder:
(
logic
)
{
subtitle:
GetBuilder
<
SyncLogic
>(
builder:
(
logic
)
{
return
Text
(
return
'待上传:
${state.dataList[i].count}
, 错误数量:
${state.dataList[i].errorCount}
,更新时间:
${state.dataList[i].updateTime ?? ''}
'
,
// Text(
// '待上传:${state.dataList[i].count}, 错误数量:${state.dataList[i].errorCount},更新时间:${state.dataList[i].updateTime ?? ''}',
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
// )
RichText
(
maxLines:
1
,
maxLines:
1
,
overflow:
TextOverflow
.
ellipsis
,
overflow:
TextOverflow
.
ellipsis
,
text:
TextSpan
(
children:
[
TextSpan
(
text:
'待上传:
${state.dataList[i].count}
'
,
style:
const
TextStyle
(
color:
Colors
.
green
),
),
TextSpan
(
text:
' 错误数量:
${state.dataList[i].errorCount}
'
,
style:
const
TextStyle
(
color:
Colors
.
red
),
),
TextSpan
(
text:
' 更新时间:
${state.dataList[i].updateTime ?? ''}
'
,
style:
const
TextStyle
(
color:
Colors
.
black54
),
),
],
),
);
);
}),
}),
));
));
list
.
add
(
SizedBox
(
height:
1
,
child:
Container
(
height:
1
,
color:
Colors
.
black12
,
),
));
}
}
state
.
items
=
list
;
state
.
items
=
list
;
update
();
update
();
...
@@ -42,17 +69,10 @@ class SyncLogic extends GetxController {
...
@@ -42,17 +69,10 @@ class SyncLogic extends GetxController {
}
}
queryCount
()
async
{
queryCount
()
async
{
state
.
dataList
[
0
].
count
=
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
state
.
dataList
[
0
].
count
=
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
filter
().
uploadStatusEqualTo
(
'0'
).
count
();
.
filter
()
state
.
dataList
[
0
].
errorCount
=
.
uploadStatusEqualTo
(
'0'
)
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
filter
().
uploadStatusEqualTo
(
'2'
).
count
();
.
count
();
state
.
dataList
[
0
].
updateTime
=
SpHelper
.
getStorage
(
Config
.
SP_CATTLERESUME_UPDATE_TIME
);
state
.
dataList
[
0
].
errorCount
=
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
filter
()
.
uploadStatusEqualTo
(
'2'
)
.
count
();
state
.
dataList
[
0
].
updateTime
=
SpHelper
.
getStorage
(
Config
.
SP_CATTLERESUME_UPDATE_TIME
);
update
();
update
();
}
}
...
@@ -84,8 +104,7 @@ class SyncLogic extends GetxController {
...
@@ -84,8 +104,7 @@ class SyncLogic extends GetxController {
for
(
var
e
in
list
)
{
for
(
var
e
in
list
)
{
ids
.
add
(
e
!.
unid
.
toString
());
ids
.
add
(
e
!.
unid
.
toString
());
if
(
e
.
photo
!=
null
&&
e
.
photo
!.
isNotEmpty
)
{
if
(
e
.
photo
!=
null
&&
e
.
photo
!.
isNotEmpty
)
{
e
.
photoPath
=
e
.
photoPath
=
await
Base64Utils
.
base64ToFile
(
e
.
photo
!,
e
.
unid
??
''
);
await
Base64Utils
.
base64ToFile
(
e
.
photo
!,
e
.
unid
??
''
);
e
.
photo
=
''
;
e
.
photo
=
''
;
}
}
...
@@ -93,13 +112,12 @@ class SyncLogic extends GetxController {
...
@@ -93,13 +112,12 @@ class SyncLogic extends GetxController {
await
GlobalService
.
to
.
isar
.
writeTxn
(()
async
{
await
GlobalService
.
to
.
isar
.
writeTxn
(()
async
{
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
putByUnid
(
e
);
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
putByUnid
(
e
);
});
});
SpHelper
.
putStorage
(
SpHelper
.
putStorage
(
Config
.
SP_CATTLERESUME_UPDATE_TIME
,
DateTime
.
now
().
toString
());
Config
.
SP_CATTLERESUME_UPDATE_TIME
,
DateTime
.
now
().
toString
());
}
}
queryCount
();
queryCount
();
if
(
ids
.
isNotEmpty
)
{
if
(
ids
.
isNotEmpty
)
{
cattleResumeListSync
(
ids
);
cattleResumeListSync
(
ids
);
}
else
{
}
else
{
updatecattleResumeList
();
updatecattleResumeList
();
}
}
DialogUtils
.
showToast
(
'保存完成,数量:
${list.length}
'
);
DialogUtils
.
showToast
(
'保存完成,数量:
${list.length}
'
);
...
@@ -127,18 +145,13 @@ class SyncLogic extends GetxController {
...
@@ -127,18 +145,13 @@ class SyncLogic extends GetxController {
///上传基础信息数据
///上传基础信息数据
Future
<
void
>
updatecattleResumeList
()
async
{
Future
<
void
>
updatecattleResumeList
()
async
{
List
<
CattleResumeEntity
>
entityList
=
await
GlobalService
List
<
CattleResumeEntity
>
entityList
=
.
to
.
isar
.
cattleResumeEntitys
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
filter
().
uploadStatusEqualTo
(
'0'
).
limit
(
10
).
findAll
();
.
filter
()
.
uploadStatusEqualTo
(
'0'
)
.
limit
(
10
)
.
findAll
();
///转图片为base64
///转图片为base64
for
(
int
i
=
0
;
i
<
entityList
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
entityList
.
length
;
i
++)
{
if
(
EmptyUtils
.
isStrNotEmpty
(
entityList
[
i
].
photoPath
))
{
if
(
EmptyUtils
.
isStrNotEmpty
(
entityList
[
i
].
photoPath
))
{
entityList
[
i
].
photo
=
entityList
[
i
].
photo
=
await
Base64Utils
.
fileToBase64
(
entityList
[
i
].
photoPath
!);
await
Base64Utils
.
fileToBase64
(
entityList
[
i
].
photoPath
!);
}
}
}
}
if
(
entityList
.
isNotEmpty
)
{
if
(
entityList
.
isNotEmpty
)
{
...
...
lib/pages/sync/sync_view.dart
View file @
23c8f3b0
...
@@ -18,6 +18,7 @@ class SyncPage extends StatelessWidget {
...
@@ -18,6 +18,7 @@ class SyncPage extends StatelessWidget {
return
Scaffold
(
return
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
title:
const
Text
(
'数据同步'
),
title:
const
Text
(
'数据同步'
),
backgroundColor:
Colors
.
blue
,
centerTitle:
true
,
centerTitle:
true
,
actions:
[
actions:
[
InkWell
(
InkWell
(
...
...
lib/utils/base64_utils.dart
View file @
23c8f3b0
...
@@ -4,6 +4,8 @@ import 'dart:typed_data';
...
@@ -4,6 +4,8 @@ import 'dart:typed_data';
import
'package:anchor_collect_flutter/utils/storage_utils.dart'
;
import
'package:anchor_collect_flutter/utils/storage_utils.dart'
;
import
'dialog_utils.dart'
;
class
Base64Utils
{
class
Base64Utils
{
static
Future
<
String
>
fileToBase64
(
String
imagePath
)
async
{
static
Future
<
String
>
fileToBase64
(
String
imagePath
)
async
{
// 读取本地文件
// 读取本地文件
...
@@ -17,11 +19,16 @@ class Base64Utils {
...
@@ -17,11 +19,16 @@ class Base64Utils {
}
}
static
Future
<
String
>
base64ToFile
(
String
photo
,
String
unid
)
async
{
static
Future
<
String
>
base64ToFile
(
String
photo
,
String
unid
)
async
{
Uint8List
bytes
=
base64
.
decode
(
photo
);
String
fullPath
=
''
;
String
fullPath
=
StorageUtils
.
getPath
(
unid
??
''
);
try
{
print
(
"local file full path
${fullPath}
"
);
Uint8List
bytes
=
base64
.
decode
(
photo
);
File
file
=
File
(
fullPath
);
String
fullPath
=
StorageUtils
.
getPath
(
unid
??
''
);
await
file
.
writeAsBytes
(
bytes
);
print
(
"local file full path
${fullPath}
"
);
File
file
=
File
(
fullPath
);
await
file
.
writeAsBytes
(
bytes
);
}
catch
(
e
)
{
// DialogUtils.showToast('保存图片异常');
}
return
fullPath
;
return
fullPath
;
}
}
...
...
pubspec.lock
View file @
23c8f3b0
...
@@ -342,6 +342,14 @@ packages:
...
@@ -342,6 +342,14 @@ packages:
description: flutter
description: flutter
source: sdk
source: sdk
version: "0.0.0"
version: "0.0.0"
flutter_blue:
dependency: "direct main"
description:
name: flutter_blue
sha256: f7f76b9b80455b0375693ec96c276fadb01e94d8441fa1740a64980cd1aeda5c
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.8.0"
flutter_cache_manager:
flutter_cache_manager:
dependency: transitive
dependency: transitive
description:
description:
...
@@ -860,10 +868,10 @@ packages:
...
@@ -860,10 +868,10 @@ packages:
dependency: transitive
dependency: transitive
description:
description:
name: rxdart
name: rxdart
sha256: "
0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb
"
sha256: "
2ef8b4e91cb3b55d155e0e34eeae0ac7107974e451495c955ac04ddee8cc21fd
"
url: "https://pub.flutter-io.cn"
url: "https://pub.flutter-io.cn"
source: hosted
source: hosted
version: "0.2
7.7
"
version: "0.2
6.0
"
shared_preferences:
shared_preferences:
dependency: "direct main"
dependency: "direct main"
description:
description:
...
...
pubspec.yaml
View file @
23c8f3b0
...
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
...
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
# of the product and file versions while build-number is used as the build suffix.
version
:
1.0.
1+2
version
:
1.0.
3+4
environment
:
environment
:
sdk
:
'
>=3.1.0
<4.0.0'
sdk
:
'
>=3.1.0
<4.0.0'
...
@@ -57,7 +57,7 @@ dependencies:
...
@@ -57,7 +57,7 @@ dependencies:
package_info
:
^2.0.2
#获取包名
package_info
:
^2.0.2
#获取包名
device_info_plus
:
^8.2.2
#获取设备信息(版本号等)
device_info_plus
:
^8.2.2
#获取设备信息(版本号等)
r_upgrade
:
^0.4.2
#版本更新
r_upgrade
:
^0.4.2
#版本更新
flutter_blue
:
^0.8.0
dev_dependencies
:
dev_dependencies
:
flutter_test
:
flutter_test
:
...
...
test/widget_test.dart
View file @
23c8f3b0
...
@@ -13,7 +13,7 @@ import 'package:anchor_collect_flutter/main.dart';
...
@@ -13,7 +13,7 @@ import 'package:anchor_collect_flutter/main.dart';
void
main
(
)
{
void
main
(
)
{
testWidgets
(
'Counter increments smoke test'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Counter increments smoke test'
,
(
WidgetTester
tester
)
async
{
// Build our app and trigger a frame.
// Build our app and trigger a frame.
await
tester
.
pumpWidget
(
MyApp
());
//
await tester.pumpWidget( MyApp());
// Verify that our counter starts at 0.
// Verify that our counter starts at 0.
expect
(
find
.
text
(
'0'
),
findsOneWidget
);
expect
(
find
.
text
(
'0'
),
findsOneWidget
);
...
...
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