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
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 @@
<uses-permission
android:name=
"android.permission.ACCESS_NOTIFICATION_POLICY"
/>
<application
android:label=
"
良种肉牛追溯系统
"
android:label=
"
掌上牧场
"
android:name=
"${applicationName}"
android:icon=
"@mipmap/ic_launcher"
android:usesCleartextTraffic=
"true"
...
...
ios/Runner/Info.plist
View file @
23c8f3b0
...
...
@@ -13,7 +13,7 @@
<
k
e
y
>
CFBundleInfoDictionaryVersion
<
/k
e
y
>
<
string
>
6.0
<
/string
>
<
k
e
y
>
CFBundleName
<
/k
e
y
>
<
string
>
良种肉牛追溯系统
<
/string
>
<
string
>
掌上牧场
<
/string
>
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
string
>
APPL
<
/string
>
<
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
'api_response.dart'
;
...
...
lib/api/HttpUtils.dart
View file @
23c8f3b0
...
...
@@ -154,7 +154,8 @@ class HttpUtils<T> {
_handleResponse
(
response
);
}
catch
(
e
)
{
var
exception
=
ApiException
.
from
(
e
);
DialogUtils
.
dismissDialog
();
// DialogUtils.dismissDialog();
loading
.
dismissLoading
();
if
(
errorCallback
!=
null
)
{
errorCallback
!(
e
.
toString
(),
exception
.
code
??
-
1
);
}
...
...
@@ -164,6 +165,7 @@ class HttpUtils<T> {
}
void
_handleResponse
(
Response
response
)
{
loading
.
dismissLoading
();
if
(
response
.
statusCode
==
200
)
{
ApiResponse
<
T
>
apiResponse
;
if
(
isList
)
{
...
...
@@ -172,7 +174,6 @@ class HttpUtils<T> {
apiResponse
=
ApiResponse
<
T
>.
fromJson
(
response
.
data
);
}
if
(
apiResponse
.
code
==
NetWorkConfig
.
successCode
)
{
loading
.
dismissLoading
();
if
(
isList
)
{
responseListCallback
?.
call
(
apiResponse
.
list
);
}
else
{
...
...
@@ -181,13 +182,10 @@ class HttpUtils<T> {
}
}
}
else
{
loading
.
dismissLoading
();
interceptToken
(
apiResponse
.
msg
,
apiResponse
.
code
);
// EasyLoading.showError(apiResponse.message);
}
}
else
{
loading
.
dismissLoading
();
var
exception
=
ApiException
(
response
.
statusCode
,
ApiException
.
unknownException
);
errorCallback
!(
exception
.
message
??
'服务器异常'
,
exception
.
code
??
-
1
);
...
...
@@ -203,7 +201,7 @@ class HttpUtils<T> {
// NetWorkUtils.getVisitorToken();
break
;
default
:
EasyLoading
.
showError
(
msg
);
//
EasyLoading.showError(msg);
errorCallback
!(
msg
,
code
??
-
1
);
break
;
}
...
...
lib/api/NetWorkConfig.dart
View file @
23c8f3b0
...
...
@@ -4,7 +4,7 @@ import 'package:anchor_collect_flutter/api/apis.dart';
class
NetWorkConfig
{
static
String
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
writeTimeOut
=
10000
;
static
const
int
successCode
=
0
;
...
...
lib/api/apis.dart
View file @
23c8f3b0
...
...
@@ -10,7 +10,7 @@ class APIS{
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_get_dict
=
"/api/dict/data/list"
;
//登录时获取字典项
...
...
lib/congifs.dart
View file @
23c8f3b0
...
...
@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
import
'package:get/get.dart'
;
class
Config
{
static
const
String
appName
=
"
良种肉牛追溯系统
"
;
static
const
String
appName
=
"
掌上牧场
"
;
static
String
baseUrl
=
""
;
...
...
lib/controllers/ble_service.dart
View file @
23c8f3b0
...
...
@@ -135,7 +135,7 @@ class BleService extends GetxService {
// 发现服务和特性
final
services
=
await
ble
.
discoverServices
(
device
.
id
);
for
(
final
service
in
services
)
{
if
(
service
.
serviceId
.
toString
()
==
'000180'
)
{
if
(
service
.
serviceId
.
toString
()
.
startsWith
(
'0000180'
)
)
{
_serviceId
=
service
.
serviceId
;
if
(
kDebugMode
)
{
print
(
'Discovered service
${service.serviceId}
'
);
...
...
lib/models/cattle_resume_entity.dart
View file @
23c8f3b0
...
...
@@ -76,7 +76,7 @@ class CattleResumeEntity {
/** 照片路径, 手持机用*/
String
?
photoPath
;
/** 状态(
育种,育成,成年;淘汰,出售
) */
/** 状态(
养殖中1,淘汰2,死亡3,出售4
) */
String
?
status
;
/** 是否淘汰;0,在用,1淘汰 */
...
...
lib/pages/camera/camera_view.dart
View file @
23c8f3b0
...
...
@@ -29,11 +29,24 @@ class CameraPage extends StatelessWidget {
child:
CameraPreview
(
Config
.
controller
),
// 显示相机预览
),
),
ListTile
(
leading:
const
Icon
(
Icons
.
camera
),
title:
const
Text
(
'拍照'
),
onTap:
logic
.
capturePicture
,
// 点击后捕获图片
),
Row
(
children:
[
Expanded
(
child:
TextButton
(
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 {
bool
isShow
=
false
;
queryByFilter
()
async
{
state
.
dataList
.
clear
();
if
(
EmptyUtils
.
isStrNotEmpty
(
state
.
filterHighNo
)&&
EmptyUtils
.
isStrNotEmpty
(
state
.
filterVisualNo
)&&
EmptyUtils
.
isStrNotEmpty
(
state
.
filterFatherNo
)&&
EmptyUtils
.
isStrNotEmpty
(
state
.
filterMotherNo
)){
state
.
dataList
=
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
filter
().
unidIsNotEmpty
().
findAll
();
}
else
{
if
(!
EmptyUtils
.
isStrNotEmpty
(
state
.
filterHighNo
)
&&
!
EmptyUtils
.
isStrNotEmpty
(
state
.
filterVisualNo
)
&&
!
EmptyUtils
.
isStrNotEmpty
(
state
.
filterFatherNo
)
&&
!
EmptyUtils
.
isStrNotEmpty
(
state
.
filterMotherNo
))
{
state
.
isFilter
=
false
;
queryFirstPage
();
}
else
{
state
.
isFilter
=
true
;
state
.
dataList
=
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
filter
()
.
optional
(
EmptyUtils
.
isStrNotEmpty
(
state
.
filterHighNo
),
(
q
)
=>
q
.
registrationNoEqualTo
(
state
.
filterHighNo
))
...
...
@@ -30,15 +33,43 @@ class CattleResumeListLogic extends GetxController {
.
optional
(
EmptyUtils
.
isStrNotEmpty
(
state
.
filterMotherNo
),
(
q
)
=>
q
.
motherRegEqualTo
(
state
.
filterMotherNo
))
.
findAll
();
}
isShow
=
false
;
isShow
=
false
;
getItemList
(
state
.
dataList
);
}
queryAll
()
async
{
state
.
dataList
=
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
filter
().
unidIsNotEmpty
().
findAll
();
queryFirstPage
()
{
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
);
}
onRefresh
()
{
state
.
dataList
.
clear
();
queryOnePage
();
}
onLoad
()
{
if
(!
state
.
isFilter
)
{
state
.
pagination
++;
queryOnePage
();
}
}
clean
()
{
state
.
filterHighNo
=
''
;
state
.
filterVisualNo
=
''
;
...
...
lib/pages/cattle_resume/cattle_resume_list/cattle_resume_list_state.dart
View file @
23c8f3b0
...
...
@@ -8,11 +8,16 @@ class CattleResumeListState {
late
List
<
CattleResumeEntity
>
dataList
;
late
List
<
Widget
>
items
;
int
pageCount
=
10
;
int
pagination
=
1
;
String
filterHighNo
=
''
;
String
filterVisualNo
=
''
;
String
filterFatherNo
=
''
;
String
filterMotherNo
=
''
;
bool
isFilter
=
false
;
CattleResumeListState
()
{
items
=
[];
dataList
=
[
...
...
lib/pages/cattle_resume/cattle_resume_list/cattle_resume_list_view.dart
View file @
23c8f3b0
import
'package:easy_refresh/easy_refresh.dart'
;
import
'package:flutter/material.dart'
;
import
'package:get/get.dart'
;
...
...
@@ -6,16 +7,18 @@ import 'cattle_resume_list_logic.dart';
class
CattleResumeListPage
extends
StatelessWidget
{
CattleResumeListPage
({
Key
?
key
})
:
super
(
key:
key
);
final
logic
=
Get
.
find
<
CattleResumeListLogic
>();
final
state
=
Get
.
find
<
CattleResumeListLogic
>()
.
state
;
final
state
=
Get
.
find
<
CattleResumeListLogic
>().
state
;
late
EasyRefreshController
_controller
;
@override
Widget
build
(
BuildContext
context
)
{
logic
.
queryAll
();
_controller
=
EasyRefreshController
();
logic
.
queryFirstPage
();
return
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'基础信息列表'
),
backgroundColor:
Colors
.
blue
,
centerTitle:
true
,
actions:
[
Padding
(
...
...
@@ -43,143 +46,146 @@ class CattleResumeListPage extends StatelessWidget {
body:
GetBuilder
<
CattleResumeListLogic
>(
builder:
(
logic
)
{
return
Center
(
child:
Stack
(
children:
[
ListView
.
separated
(
itemCount:
state
.
items
.
length
,
itemBuilder:
(
context
,
index
)
{
return
state
.
items
[
index
];
},
separatorBuilder:
(
context
,
index
)
{
return
Container
(
height:
3
,
color:
Colors
.
black12
,
);
},
),
EasyRefresh
(
controller:
_controller
,
onLoad:
()=>
logic
.
onLoad
(),
onRefresh:
()=>
logic
.
onRefresh
(),
child:
ListView
.
separated
(
itemCount:
state
.
items
.
length
,
itemBuilder:
(
context
,
index
)
{
return
state
.
items
[
index
];
},
separatorBuilder:
(
context
,
index
)
{
return
Container
(
height:
3
,
color:
Colors
.
black12
,
);
},
),
),
logic
.
isShow
?
Row
(
children:
[
Expanded
(
child:
InkWell
(
child:
Container
(
height:
double
.
infinity
,
color:
Colors
.
black26
,
),
onTap:
()
=>
{
logic
.
isShow
=
false
,
logic
.
update
(),
},
),
),
GetBuilder
<
CattleResumeListLogic
>(
builder:
(
logic
)
{
return
Container
(
width:
280
,
color:
Colors
.
white
,
padding:
const
EdgeInsets
.
all
(
20
),
child:
Column
(
mainAxisSize:
MainAxisSize
.
max
,
children:
[
TextField
(
onChanged:
(
text
)
{
state
.
filterHighNo
=
text
;
},
decoration:
const
InputDecoration
(
prefixIcon:
Icon
(
Icons
.
search
),
border:
OutlineInputBorder
(),
hintText:
'电子耳标'
,
contentPadding:
EdgeInsets
.
symmetric
(
horizontal:
10.0
,
vertical:
8.0
),
),
),
const
SizedBox
(
height:
10
,
),
TextField
(
onChanged:
(
text
)
{
state
.
filterVisualNo
=
text
;
},
decoration:
const
InputDecoration
(
prefixIcon:
Icon
(
Icons
.
search
),
border:
OutlineInputBorder
(),
hintText:
'可视耳标'
,
contentPadding:
EdgeInsets
.
symmetric
(
horizontal:
10.0
,
vertical:
8.0
),
),
),
const
SizedBox
(
height:
10
,
),
TextField
(
onChanged:
(
text
)
{
state
.
filterFatherNo
=
text
;
},
decoration:
const
InputDecoration
(
prefixIcon:
Icon
(
Icons
.
search
),
border:
OutlineInputBorder
(),
hintText:
'父登记号'
,
contentPadding:
EdgeInsets
.
symmetric
(
horizontal:
10.0
,
vertical:
8.0
),
children:
[
Expanded
(
child:
InkWell
(
child:
Container
(
height:
double
.
infinity
,
color:
Colors
.
black26
,
),
),
const
SizedBox
(
height:
10
,
),
TextField
(
onChanged:
(
text
)
{
state
.
filterMotherNo
=
text
;
onTap:
()
=>
{
logic
.
isShow
=
false
,
logic
.
update
(),
},
decoration:
const
InputDecoration
(
prefixIcon:
Icon
(
Icons
.
search
),
border:
OutlineInputBorder
(),
hintText:
'母登记号'
,
contentPadding:
EdgeInsets
.
symmetric
(
horizontal:
10.0
,
vertical:
8.0
),
),
),
const
SizedBox
(
height:
10
,
),
SizedBox
(
width:
Get
.
width
,
child:
TextButton
(
style:
ButtonStyle
(
backgroundColor:
MaterialStateProperty
.
all
(
Colors
.
blue
),
foregroundColor:
MaterialStateProperty
.
all
(
Colors
.
white
),
padding:
MaterialStateProperty
.
all
(
const
EdgeInsets
.
all
(
10
)),
),
onPressed:
()
=>
{
logic
.
queryByFilter
(),
},
child:
const
Text
(
"查询"
),
),
),
const
SizedBox
(
height:
10
,
),
SizedBox
(
width:
Get
.
width
,
child:
TextButton
(
style:
ButtonStyle
(
backgroundColor:
MaterialStateProperty
.
all
(
Colors
.
white
),
foregroundColor:
MaterialStateProperty
.
all
(
Colors
.
blue
),
padding:
MaterialStateProperty
.
all
(
const
EdgeInsets
.
all
(
10
)),
shape:
MaterialStateProperty
.
all
<
RoundedRectangleBorder
>(
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
10
),
),
GetBuilder
<
CattleResumeListLogic
>(
builder:
(
logic
)
{
return
Container
(
width:
280
,
color:
Colors
.
white
,
padding:
const
EdgeInsets
.
all
(
20
),
child:
Column
(
mainAxisSize:
MainAxisSize
.
max
,
children:
[
TextField
(
onChanged:
(
text
)
{
state
.
filterHighNo
=
text
;
},
decoration:
const
InputDecoration
(
prefixIcon:
Icon
(
Icons
.
search
),
border:
OutlineInputBorder
(),
hintText:
'电子耳标(点击扫描)'
,
contentPadding:
EdgeInsets
.
symmetric
(
horizontal:
10.0
,
vertical:
8.0
),
),
),
const
SizedBox
(
height:
10
,
),
TextField
(
onChanged:
(
text
)
{
state
.
filterVisualNo
=
text
;
},
decoration:
const
InputDecoration
(
prefixIcon:
Icon
(
Icons
.
search
),
border:
OutlineInputBorder
(),
hintText:
'可视耳标'
,
contentPadding:
EdgeInsets
.
symmetric
(
horizontal:
10.0
,
vertical:
8.0
),
),
),
side:
MaterialStateProperty
.
all
<
BorderSide
>(
const
BorderSide
(
color:
Colors
.
black54
,
// 边框颜色
width:
1
,
// 边框宽度
)),
),
onPressed:
()
=>
logic
.
clean
(),
child:
const
Text
(
"重置"
),
const
SizedBox
(
height:
10
,
),
TextField
(
onChanged:
(
text
)
{
state
.
filterFatherNo
=
text
;
},
decoration:
const
InputDecoration
(
prefixIcon:
Icon
(
Icons
.
search
),
border:
OutlineInputBorder
(),
hintText:
'父登记号'
,
contentPadding:
EdgeInsets
.
symmetric
(
horizontal:
10.0
,
vertical:
8.0
),
),
),
const
SizedBox
(
height:
10
,
),
TextField
(
onChanged:
(
text
)
{
state
.
filterMotherNo
=
text
;
},
decoration:
const
InputDecoration
(
prefixIcon:
Icon
(
Icons
.
search
),
border:
OutlineInputBorder
(),
hintText:
'母登记号'
,
contentPadding:
EdgeInsets
.
symmetric
(
horizontal:
10.0
,
vertical:
8.0
),
),
),
const
SizedBox
(
height:
10
,
),
SizedBox
(
width:
Get
.
width
,
child:
TextButton
(
style:
ButtonStyle
(
backgroundColor:
MaterialStateProperty
.
all
(
Colors
.
blue
),
foregroundColor:
MaterialStateProperty
.
all
(
Colors
.
white
),
padding:
MaterialStateProperty
.
all
(
const
EdgeInsets
.
all
(
10
)),
),
onPressed:
()
=>
{
logic
.
queryByFilter
(),
},
child:
const
Text
(
"查询"
),
),
),
const
SizedBox
(
height:
10
,
),
SizedBox
(
width:
Get
.
width
,
child:
TextButton
(
style:
ButtonStyle
(
backgroundColor:
MaterialStateProperty
.
all
(
Colors
.
white
),
foregroundColor:
MaterialStateProperty
.
all
(
Colors
.
blue
),
padding:
MaterialStateProperty
.
all
(
const
EdgeInsets
.
all
(
10
)),
shape:
MaterialStateProperty
.
all
<
RoundedRectangleBorder
>(
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
10
),
),
),
side:
MaterialStateProperty
.
all
<
BorderSide
>(
const
BorderSide
(
color:
Colors
.
black54
,
// 边框颜色
width:
1
,
// 边框宽度
)),
),
onPressed:
()
=>
logic
.
clean
(),
child:
const
Text
(
"重置"
),
),
),
],
),
),
],
),
);
}),
],
)
);
}),
],
)
:
Container
(),
]),
);
...
...
lib/pages/cattle_resume/cattle_resume_logic.dart
View file @
23c8f3b0
...
...
@@ -105,7 +105,7 @@ class CattleResumeLogic extends GetxController {
DialogUtils
.
showToast
(
'必须填写可视耳标'
);
return
true
;
}
if
(!
EmptyUtils
.
isStrNotEmpty
(
state
.
entity
.
photoPath
))
{
if
(!
EmptyUtils
.
isStrNotEmpty
(
state
.
entity
.
photoPath
)
&&!
EmptyUtils
.
isStrNotEmpty
(
state
.
photoPath
)
)
{
DialogUtils
.
showToast
(
'必须上传牛只拍照'
);
return
true
;
}
...
...
lib/pages/cattle_resume/cattle_resume_view.dart
View file @
23c8f3b0
...
...
@@ -8,6 +8,7 @@ import 'package:get/get.dart';
import
'../../congifs.dart'
;
import
'../../routes/routes.dart'
;
import
'../../utils/empty_utils.dart'
;
import
'../../widget/NullDataView.dart'
;
import
'cattle_resume_logic.dart'
;
import
'package:flutter_speed_dial/flutter_speed_dial.dart'
;
...
...
@@ -22,6 +23,7 @@ class CattleResumePage extends StatelessWidget {
return
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'基础信息'
),
backgroundColor:
Colors
.
blue
,
centerTitle:
true
,
),
body:
Column
(
...
...
@@ -35,10 +37,12 @@ class CattleResumePage extends StatelessWidget {
InkWell
(
child:
AspectRatio
(
aspectRatio:
1.0
/
1.0
,
child:
Image
.
file
(
File
(
state
.
photoPath
??
''
),
fit:
BoxFit
.
contain
,
),
child:
EmptyUtils
.
isStrNotEmpty
(
state
.
photoPath
)
?
Image
.
file
(
File
(
state
.
photoPath
??
''
),
fit:
BoxFit
.
contain
,
)
:
const
NullDataView
(),
),
onTap:
()
async
{
var
photoPath
=
await
Get
.
toNamed
(
AppRoute
.
CAMERA
,
arguments:
state
.
unid
);
...
...
@@ -97,17 +101,20 @@ class CattleResumePage extends StatelessWidget {
logic
.
update
(),
}),
}),
getItemView
(
'出生日期'
,
state
.
entity
.
birthdate
??
''
,
()
=>
{
DialogUtils
.
showTimeDialog
(
context
,
isTime:
true
,
title:
'请选择出生日期'
,
onPositive:
(
date
)=>{
state
.
entity
.
birthdate
=
date
,
logic
.
update
(),
},
),
}),
getItemView
(
'出生日期'
,
state
.
entity
.
birthdate
??
''
,
()
=>
{
DialogUtils
.
showTimeDialog
(
context
,
isTime:
false
,
title:
'请选择出生日期'
,
onPositive:
(
date
)
=>
{
state
.
entity
.
birthdate
=
date
,
logic
.
update
(),
},
),
}),
const
SizedBox
(
width:
10
,
),
...
...
@@ -364,73 +371,76 @@ class CattleResumePage extends StatelessWidget {
],
),
floatingActionButtonLocation:
FloatingActionButtonLocation
.
endFloat
,
floatingActionButton:
SpeedDial
(
icon:
Icons
.
add
,
activeIcon:
Icons
.
close
,
spacing:
3
,
// openCloseDial: ValueNotifier.value,
childPadding:
const
EdgeInsets
.
all
(
5
),
buttonSize:
const
Size
(
40
,
40
),
elevation:
8.0
,
children:
[
SpeedDialChild
(
child:
const
Icon
(
IconFont
.
cattle_resume
),
backgroundColor:
Colors
.
black
,
foregroundColor:
Colors
.
white
,
label:
'基础信息'
,
onTap:
()
{
DialogUtils
.
showToast
(
'toast...'
);
},
onLongPress:
()
=>
debugPrint
(
'FIRST CHILD LONG PRESS'
),
),
SpeedDialChild
(
child:
const
Icon
(
IconFont
.
performance
),
backgroundColor:
const
Color
.
fromARGB
(
255
,
104
,
152
,
218
),
foregroundColor:
Colors
.
white
,
label:
'性能测定'
,
onTap:
()
=>
{
DialogUtils
.
showLoadingDialog
(
'加载中...'
),
},
),
SpeedDialChild
(
child:
const
Icon
(
IconFont
.
medical_record
),
backgroundColor:
const
Color
.
fromARGB
(
255
,
220
,
128
,
70
),
foregroundColor:
Colors
.
white
,
label:
'诊疗记录'
,
visible:
true
,
onTap:
()
=>
DialogUtils
.
showInputDialog
(
onPositive:
(
inputStr
)
{
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
SnackBar
(
content:
Text
(
inputStr
)));
}),
onLongPress:
()
=>
debugPrint
(
'THIRD CHILD LONG PRESS'
),
),
SpeedDialChild
(
child:
const
Icon
(
IconFont
.
breeding_record
),
backgroundColor:
const
Color
.
fromARGB
(
255
,
210
,
76
,
154
),
foregroundColor:
Colors
.
white
,
label:
'配种记录'
,
onTap:
()
=>
{
DialogUtils
.
showWarningDialog
(
'配种记录!!'
)},
onLongPress:
()
=>
debugPrint
(
'FIRST CHILD LONG PRESS'
),
),
SpeedDialChild
(
child:
const
Icon
(
IconFont
.
immune
),
backgroundColor:
const
Color
.
fromARGB
(
255
,
116
,
154
,
110
),
foregroundColor:
Colors
.
white
,
label:
'免疫记录'
,
onTap:
()
=>
{},
),
SpeedDialChild
(
child:
const
Icon
(
IconFont
.
weight
),
backgroundColor:
const
Color
.
fromARGB
(
255
,
150
,
114
,
89
),
foregroundColor:
Colors
.
white
,
label:
'称重记录'
,
visible:
true
,
onTap:
()
=>
DialogUtils
.
showMultipleListDialog
([
'aaa'
,
'bbb'
,
'ccc'
],
[
'111'
,
'222'
,
'333'
],
onPositive:
(
result
)
{
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
SnackBar
(
content:
Text
(
result
)));
}),
// onLongPress: () => ,
),
],
floatingActionButton:
Padding
(
padding:
const
EdgeInsets
.
only
(
right:
20.0
,
bottom:
80.0
),
child:
SpeedDial
(
icon:
Icons
.
add
,
activeIcon:
Icons
.
close
,
spacing:
3
,
// openCloseDial: ValueNotifier.value,
childPadding:
const
EdgeInsets
.
all
(
5
),
buttonSize:
const
Size
(
40
,
40
),
elevation:
8.0
,
children:
[
SpeedDialChild
(
child:
const
Icon
(
IconFont
.
cattle_resume
),
backgroundColor:
Colors
.
black
,
foregroundColor:
Colors
.
white
,
label:
'基础信息'
,
onTap:
()
{
DialogUtils
.
showToast
(
'toast...'
);
},
onLongPress:
()
=>
debugPrint
(
'FIRST CHILD LONG PRESS'
),
),
SpeedDialChild
(
child:
const
Icon
(
IconFont
.
performance
),
backgroundColor:
const
Color
.
fromARGB
(
255
,
104
,
152
,
218
),
foregroundColor:
Colors
.
white
,
label:
'性能测定'
,
onTap:
()
=>
{
DialogUtils
.
showLoadingDialog
(
'加载中...'
),
},
),
SpeedDialChild
(
child:
const
Icon
(
IconFont
.
medical_record
),
backgroundColor:
const
Color
.
fromARGB
(
255
,
220
,
128
,
70
),
foregroundColor:
Colors
.
white
,
label:
'诊疗记录'
,
visible:
true
,
onTap:
()
=>
DialogUtils
.
showInputDialog
(
onPositive:
(
inputStr
)
{
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
SnackBar
(
content:
Text
(
inputStr
)));
}),
onLongPress:
()
=>
debugPrint
(
'THIRD CHILD LONG PRESS'
),
),
SpeedDialChild
(
child:
const
Icon
(
IconFont
.
breeding_record
),
backgroundColor:
const
Color
.
fromARGB
(
255
,
210
,
76
,
154
),
foregroundColor:
Colors
.
white
,
label:
'配种记录'
,
onTap:
()
=>
{
DialogUtils
.
showWarningDialog
(
'配种记录!!'
)},
onLongPress:
()
=>
debugPrint
(
'FIRST CHILD LONG PRESS'
),
),
SpeedDialChild
(
child:
const
Icon
(
IconFont
.
immune
),
backgroundColor:
const
Color
.
fromARGB
(
255
,
116
,
154
,
110
),
foregroundColor:
Colors
.
white
,
label:
'免疫记录'
,
onTap:
()
=>
{},
),
SpeedDialChild
(
child:
const
Icon
(
IconFont
.
weight
),
backgroundColor:
const
Color
.
fromARGB
(
255
,
150
,
114
,
89
),
foregroundColor:
Colors
.
white
,
label:
'称重记录'
,
visible:
true
,
onTap:
()
=>
DialogUtils
.
showMultipleListDialog
([
'aaa'
,
'bbb'
,
'ccc'
],
[
'111'
,
'222'
,
'333'
],
onPositive:
(
result
)
{
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 {
//
// update();
}
///获取游客令牌
void
getVisitorToken
()
async
{
...
...
@@ -35,7 +36,6 @@ class HomeLogic extends GetxController {
Map
<
String
,
String
>
map
=
{};
//参数
String
strMd5
=
''
;
map
.
putIfAbsent
(
'code'
,
()
=>
''
);
map
.
putIfAbsent
(
'userType'
,
()
=>
'Tourist'
);
String
apiKey
=
'kangeqiu@8868!'
;
...
...
@@ -56,16 +56,13 @@ class HomeLogic extends GetxController {
// return true; //false 表示没有处理移除 ture 表示处理了异常 默认值 false
// }
// );
}
getBreedingCount
()
async
{
breedingCount
.
value
=
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
count
();
// breedingCount.value = 650;
obsoleteCount
.
value
=
await
GlobalService
.
to
.
isar
.
dictEntitys
.
count
();
deadCount
.
value
=
4
;
sellCount
.
value
=
8
;
breedingCount
.
value
=
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
filter
().
statusEqualTo
(
'1'
).
count
();
obsoleteCount
.
value
=
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
filter
().
statusEqualTo
(
'2'
).
count
();
deadCount
.
value
=
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
filter
().
statusEqualTo
(
'3'
).
count
();
sellCount
.
value
=
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
filter
().
statusEqualTo
(
'4'
).
count
();
}
forWard
(
String
title
)
{
...
...
@@ -90,6 +87,5 @@ class HomeLogic extends GetxController {
void
onInit
()
{
getBreedingCount
();
// update();
}
}
lib/pages/home/home_view.dart
View file @
23c8f3b0
...
...
@@ -31,7 +31,11 @@ class HomePage extends StatelessWidget {
child:
Column
(
children:
[
//banner
Image
.
asset
(
'images/banner.png'
),
Image
.
asset
(
'images/banner.png'
,
height:
200
,
fit:
BoxFit
.
cover
,
),
//牛只数量
Row
(
children:
[
...
...
@@ -39,15 +43,13 @@ class HomePage extends StatelessWidget {
width:
8
,
),
Obx
(()
{
return
_getCountItem
(
'images/1.png'
,
'养殖中'
,
logic
.
breedingCount
.
value
,
IconFont
.
breeding_count
);
return
_getCountItem
(
'images/1.png'
,
'养殖中'
,
logic
.
breedingCount
.
value
,
IconFont
.
breeding_count
);
}),
const
SizedBox
(
width:
8
,
),
Obx
(()
{
return
_getCountItem
(
'images/2.png'
,
'已淘汰'
,
logic
.
obsoleteCount
.
value
,
IconFont
.
obsolete_count
);
return
_getCountItem
(
'images/2.png'
,
'已淘汰'
,
logic
.
obsoleteCount
.
value
,
IconFont
.
obsolete_count
);
}),
const
SizedBox
(
width:
8
,
...
...
@@ -60,8 +62,7 @@ class HomePage extends StatelessWidget {
width:
8
,
),
Obx
(()
{
return
_getCountItem
(
'images/3.png'
,
'已死亡'
,
logic
.
deadCount
.
value
,
IconFont
.
dead_count
);
return
_getCountItem
(
'images/3.png'
,
'已死亡'
,
logic
.
deadCount
.
value
,
IconFont
.
dead_count
);
}),
const
SizedBox
(
width:
8
,
...
...
@@ -104,13 +105,11 @@ class HomePage extends StatelessWidget {
const
SizedBox
(
width:
8
,
),
_getFunButton
(
'性能测定'
,
IconFont
.
performance
,
const
Color
.
fromARGB
(
255
,
104
,
152
,
218
)),
_getFunButton
(
'性能测定'
,
IconFont
.
performance
,
const
Color
.
fromARGB
(
255
,
104
,
152
,
218
)),
const
SizedBox
(
width:
8
,
),
_getFunButton
(
'诊疗记录'
,
IconFont
.
medical_record
,
const
Color
.
fromARGB
(
255
,
220
,
128
,
70
)),
_getFunButton
(
'诊疗记录'
,
IconFont
.
medical_record
,
const
Color
.
fromARGB
(
255
,
220
,
128
,
70
)),
const
SizedBox
(
width:
8
,
),
...
...
@@ -122,18 +121,15 @@ class HomePage extends StatelessWidget {
const
SizedBox
(
width:
8
,
),
_getFunButton
(
'配种记录'
,
IconFont
.
breeding_record
,
const
Color
.
fromARGB
(
255
,
210
,
76
,
154
)),
_getFunButton
(
'配种记录'
,
IconFont
.
breeding_record
,
const
Color
.
fromARGB
(
255
,
210
,
76
,
154
)),
const
SizedBox
(
width:
8
,
),
_getFunButton
(
'免疫记录'
,
IconFont
.
immune
,
const
Color
.
fromARGB
(
255
,
116
,
154
,
110
)),
_getFunButton
(
'免疫记录'
,
IconFont
.
immune
,
const
Color
.
fromARGB
(
255
,
116
,
154
,
110
)),
const
SizedBox
(
width:
8
,
),
_getFunButton
(
'称重管理'
,
IconFont
.
weight
,
const
Color
.
fromARGB
(
255
,
150
,
114
,
89
)),
_getFunButton
(
'称重管理'
,
IconFont
.
weight
,
const
Color
.
fromARGB
(
255
,
150
,
114
,
89
)),
const
SizedBox
(
width:
8
,
),
...
...
@@ -147,8 +143,7 @@ class HomePage extends StatelessWidget {
}
///banner下方的牛只数量统计
Expanded
_getCountItem
(
String
imagePath
,
String
title
,
int
count
,
IconData
iconData
)
{
Expanded
_getCountItem
(
String
imagePath
,
String
title
,
int
count
,
IconData
iconData
)
{
return
Expanded
(
child:
InkWell
(
onTap:
()
=>
{},
...
...
lib/pages/login/login_logic.dart
View file @
23c8f3b0
...
...
@@ -22,6 +22,8 @@ class LoginLogic extends GetxController {
RxString
versionStr
=
'1.0.0'
.
obs
;
RxBool
isObscure
=
true
.
obs
;
int
appId
=
0
;
LoginLogic
()
{
...
...
@@ -79,7 +81,8 @@ class LoginLogic extends GetxController {
getDictList
();
})
..
onError
((
msg
,
code
)
{
DialogUtils
.
showWarningDialog
(
'登录失败:
$msg
'
);
// DialogUtils.showWarningDialog('登录失败:$msg');
DialogUtils
.
showToast
(
'登录失败'
);
return
;
})
..
build
();
...
...
@@ -135,7 +138,6 @@ class LoginLogic extends GetxController {
HttpUtils
<
int
>()
..
get
()
..
setUrl
(
APIS
.
get_version
)
..
showLoading
()
..
onResponse
((
response
)
{
if
(
buildNumber
!=
response
.
toString
())
{
// DialogUtils.showToast('最新版本$response');
...
...
@@ -148,8 +150,7 @@ class LoginLogic extends GetxController {
// var _packageName = packageInfo.packageName;
})
..
onError
((
msg
,
code
)
{
DialogUtils
.
dismissDialog
();
DialogUtils
.
showWarningDialog
(
''
);
// DialogUtils.dismissDialog();
})
..
build
();
}
...
...
@@ -157,7 +158,7 @@ class LoginLogic extends GetxController {
///下载app
void
upgrade
()
async
{
appId
=
await
RUpgrade
.
upgrade
(
'
${APIS.baseUrl}
/api/download?type=
APP
'
,
'
${APIS.baseUrl}
/api/download?type=
Flutter
'
,
fileName:
'anchor_collect_flutter.apk'
,
installType:
RUpgradeInstallType
.
normal
,
)
??
...
...
lib/pages/login/login_view.dart
View file @
23c8f3b0
...
...
@@ -63,7 +63,9 @@ class LoginPage extends StatelessWidget {
contentPadding:
EdgeInsets
.
symmetric
(
horizontal:
10.0
,
vertical:
15.0
),
suffixIcon:
IconButton
(
icon:
ImageIcon
(
AssetImage
(
'images/ic_delete.png'
)),
onPressed:
()
{},
onPressed:
()
{
logic
.
nameController
.
text
=
''
;
},
),
),
controller:
logic
.
nameController
,
...
...
@@ -71,22 +73,26 @@ class LoginPage extends StatelessWidget {
const
SizedBox
(
height:
20
,
),
TextField
(
obscureText:
true
,
textInputAction:
TextInputAction
.
send
,
decoration:
InputDecoration
(
hintText:
'请输入您的密码'
,
border:
OutlineInputBorder
(),
filled:
true
,
fillColor:
Colors
.
white
,
contentPadding:
EdgeInsets
.
symmetric
(
horizontal:
10.0
,
vertical:
15.0
),
suffixIcon:
IconButton
(
icon:
ImageIcon
(
AssetImage
(
'images/ic_eye_open.png'
)),
onPressed:
()
{},
Obx
(()
{
return
TextField
(
obscureText:
logic
.
isObscure
.
value
,
textInputAction:
TextInputAction
.
send
,
decoration:
InputDecoration
(
hintText:
'请输入您的密码'
,
border:
OutlineInputBorder
(),
filled:
true
,
fillColor:
Colors
.
white
,
contentPadding:
EdgeInsets
.
symmetric
(
horizontal:
10.0
,
vertical:
15.0
),
suffixIcon:
IconButton
(
icon:
ImageIcon
(
AssetImage
(
'images/ic_eye_open.png'
)),
onPressed:
()
{
logic
.
isObscure
.
value
=
!
logic
.
isObscure
.
value
;
},
),
),
)
,
controller:
logic
.
passwordController
,
),
controller:
logic
.
passwordController
,
);
}
),
const
SizedBox
(
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/message/message_view.dart'
;
import
'package:anchor_collect_flutter/pages/mine/mine_view.dart'
;
...
...
@@ -13,8 +14,9 @@ import 'main_logic.dart';
class
MainPage
extends
StatelessWidget
{
final
logic
=
Get
.
find
<
MainLogic
>();
final
state
=
Get
.
find
<
MainLogic
>().
state
;
final
syncLogic
=
Get
.
find
<
Sync
Logic
>();
final
homeLogic
=
Get
.
find
<
Home
Logic
>();
final
messageLogic
=
Get
.
find
<
MessageLogic
>();
final
syncLogic
=
Get
.
find
<
SyncLogic
>();
static
final
List
<
Widget
>
_pageList
=
[
HomePage
(),
MessagePage
(),
...
...
@@ -62,6 +64,9 @@ class MainPage extends StatelessWidget {
],
onTap:
(
int
position
)
{
switch
(
position
){
case
0
:
homeLogic
.
getBreedingCount
();
break
;
case
1
:
messageLogic
.
getMessageCount
();
break
;
...
...
lib/pages/message/message_detail/message_detail_view.dart
View file @
23c8f3b0
...
...
@@ -13,6 +13,7 @@ class MessageDetailPage extends StatelessWidget {
return
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'消息详情'
),
backgroundColor:
Colors
.
blue
,
centerTitle:
true
,
),
body:
Padding
(
...
...
lib/pages/message/message_list/message_list_view.dart
View file @
23c8f3b0
...
...
@@ -15,6 +15,7 @@ class MessageListPage extends StatelessWidget {
return
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'消息列表'
),
backgroundColor:
Colors
.
blue
,
centerTitle:
true
,
),
body:
GetBuilder
<
MessageListLogic
>(
builder:
(
logic
)
{
...
...
lib/pages/message/message_view.dart
View file @
23c8f3b0
...
...
@@ -15,6 +15,7 @@ class MessagePage extends StatelessWidget {
return
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'生产提醒'
),
backgroundColor:
Colors
.
blue
,
centerTitle:
true
,
),
body:
GetBuilder
<
MessageLogic
>(
builder:
(
logic
)
{
...
...
@@ -25,7 +26,7 @@ class MessagePage extends StatelessWidget {
crossAxisSpacing:
8
,
// 横轴上Item间距
mainAxisSpacing:
8
,
// 主轴上Item间距
// mainAxisExtent: 100, // 主轴上Item长度
childAspectRatio:
1.
5
,
// 横轴长度/主轴长度
childAspectRatio:
1.
2
,
// 横轴长度/主轴长度
),
itemCount:
state
.
items
.
length
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
...
...
lib/pages/mine/mine_view.dart
View file @
23c8f3b0
...
...
@@ -11,6 +11,98 @@ class MinePage extends StatelessWidget {
final
logic
=
Get
.
find
<
MineLogic
>();
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 {
return
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'设置'
),
backgroundColor:
Colors
.
blue
,
centerTitle:
true
,
),
body:
Center
(
...
...
lib/pages/sync/sync_logic.dart
View file @
23c8f3b0
import
'package:anchor_collect_flutter/api/HttpUtils.dart'
;
import
'package:anchor_collect_flutter/congifs.dart'
;
import
'package:anchor_collect_flutter/controllers/global_service.dart'
;
...
...
@@ -24,13 +23,41 @@ class SyncLogic extends GetxController {
list
.
add
(
ListTile
(
title:
Text
(
state
.
dataList
[
i
].
title
),
subtitle:
GetBuilder
<
SyncLogic
>(
builder:
(
logic
)
{
return
Text
(
'待上传:
${state.dataList[i].count}
, 错误数量:
${state.dataList[i].errorCount}
,更新时间:
${state.dataList[i].updateTime ?? ''}
'
,
return
// Text(
// '待上传:${state.dataList[i].count}, 错误数量:${state.dataList[i].errorCount},更新时间:${state.dataList[i].updateTime ?? ''}',
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
// )
RichText
(
maxLines:
1
,
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
;
update
();
...
...
@@ -42,17 +69,10 @@ class SyncLogic extends GetxController {
}
queryCount
()
async
{
state
.
dataList
[
0
].
count
=
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
filter
()
.
uploadStatusEqualTo
(
'0'
)
.
count
();
state
.
dataList
[
0
].
errorCount
=
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
filter
()
.
uploadStatusEqualTo
(
'2'
)
.
count
();
state
.
dataList
[
0
].
updateTime
=
SpHelper
.
getStorage
(
Config
.
SP_CATTLERESUME_UPDATE_TIME
);
state
.
dataList
[
0
].
count
=
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
filter
().
uploadStatusEqualTo
(
'0'
).
count
();
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
();
}
...
...
@@ -84,8 +104,7 @@ class SyncLogic extends GetxController {
for
(
var
e
in
list
)
{
ids
.
add
(
e
!.
unid
.
toString
());
if
(
e
.
photo
!=
null
&&
e
.
photo
!.
isNotEmpty
)
{
e
.
photoPath
=
await
Base64Utils
.
base64ToFile
(
e
.
photo
!,
e
.
unid
??
''
);
e
.
photoPath
=
await
Base64Utils
.
base64ToFile
(
e
.
photo
!,
e
.
unid
??
''
);
e
.
photo
=
''
;
}
...
...
@@ -93,13 +112,12 @@ class SyncLogic extends GetxController {
await
GlobalService
.
to
.
isar
.
writeTxn
(()
async
{
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
putByUnid
(
e
);
});
SpHelper
.
putStorage
(
Config
.
SP_CATTLERESUME_UPDATE_TIME
,
DateTime
.
now
().
toString
());
SpHelper
.
putStorage
(
Config
.
SP_CATTLERESUME_UPDATE_TIME
,
DateTime
.
now
().
toString
());
}
queryCount
();
if
(
ids
.
isNotEmpty
)
{
cattleResumeListSync
(
ids
);
}
else
{
}
else
{
updatecattleResumeList
();
}
DialogUtils
.
showToast
(
'保存完成,数量:
${list.length}
'
);
...
...
@@ -127,18 +145,13 @@ class SyncLogic extends GetxController {
///上传基础信息数据
Future
<
void
>
updatecattleResumeList
()
async
{
List
<
CattleResumeEntity
>
entityList
=
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
filter
()
.
uploadStatusEqualTo
(
'0'
)
.
limit
(
10
)
.
findAll
();
List
<
CattleResumeEntity
>
entityList
=
await
GlobalService
.
to
.
isar
.
cattleResumeEntitys
.
filter
().
uploadStatusEqualTo
(
'0'
).
limit
(
10
).
findAll
();
///转图片为base64
for
(
int
i
=
0
;
i
<
entityList
.
length
;
i
++)
{
if
(
EmptyUtils
.
isStrNotEmpty
(
entityList
[
i
].
photoPath
))
{
entityList
[
i
].
photo
=
await
Base64Utils
.
fileToBase64
(
entityList
[
i
].
photoPath
!);
entityList
[
i
].
photo
=
await
Base64Utils
.
fileToBase64
(
entityList
[
i
].
photoPath
!);
}
}
if
(
entityList
.
isNotEmpty
)
{
...
...
lib/pages/sync/sync_view.dart
View file @
23c8f3b0
...
...
@@ -18,6 +18,7 @@ class SyncPage extends StatelessWidget {
return
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'数据同步'
),
backgroundColor:
Colors
.
blue
,
centerTitle:
true
,
actions:
[
InkWell
(
...
...
lib/utils/base64_utils.dart
View file @
23c8f3b0
...
...
@@ -4,6 +4,8 @@ import 'dart:typed_data';
import
'package:anchor_collect_flutter/utils/storage_utils.dart'
;
import
'dialog_utils.dart'
;
class
Base64Utils
{
static
Future
<
String
>
fileToBase64
(
String
imagePath
)
async
{
// 读取本地文件
...
...
@@ -17,11 +19,16 @@ class Base64Utils {
}
static
Future
<
String
>
base64ToFile
(
String
photo
,
String
unid
)
async
{
Uint8List
bytes
=
base64
.
decode
(
photo
);
String
fullPath
=
StorageUtils
.
getPath
(
unid
??
''
);
print
(
"local file full path
${fullPath}
"
);
File
file
=
File
(
fullPath
);
await
file
.
writeAsBytes
(
bytes
);
String
fullPath
=
''
;
try
{
Uint8List
bytes
=
base64
.
decode
(
photo
);
String
fullPath
=
StorageUtils
.
getPath
(
unid
??
''
);
print
(
"local file full path
${fullPath}
"
);
File
file
=
File
(
fullPath
);
await
file
.
writeAsBytes
(
bytes
);
}
catch
(
e
)
{
// DialogUtils.showToast('保存图片异常');
}
return
fullPath
;
}
...
...
pubspec.lock
View file @
23c8f3b0
...
...
@@ -342,6 +342,14 @@ packages:
description: flutter
source: sdk
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:
dependency: transitive
description:
...
...
@@ -860,10 +868,10 @@ packages:
dependency: transitive
description:
name: rxdart
sha256: "
0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb
"
sha256: "
2ef8b4e91cb3b55d155e0e34eeae0ac7107974e451495c955ac04ddee8cc21fd
"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2
7.7
"
version: "0.2
6.0
"
shared_preferences:
dependency: "direct main"
description:
...
...
pubspec.yaml
View file @
23c8f3b0
...
...
@@ -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
# 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.
version
:
1.0.
1+2
version
:
1.0.
3+4
environment
:
sdk
:
'
>=3.1.0
<4.0.0'
...
...
@@ -57,7 +57,7 @@ dependencies:
package_info
:
^2.0.2
#获取包名
device_info_plus
:
^8.2.2
#获取设备信息(版本号等)
r_upgrade
:
^0.4.2
#版本更新
flutter_blue
:
^0.8.0
dev_dependencies
:
flutter_test
:
...
...
test/widget_test.dart
View file @
23c8f3b0
...
...
@@ -13,7 +13,7 @@ import 'package:anchor_collect_flutter/main.dart';
void
main
(
)
{
testWidgets
(
'Counter increments smoke test'
,
(
WidgetTester
tester
)
async
{
// Build our app and trigger a frame.
await
tester
.
pumpWidget
(
MyApp
());
//
await tester.pumpWidget( MyApp());
// Verify that our counter starts at 0.
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