Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
F
flutter_clx_base
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
flutter_clx_base
Commits
3df86699
提交
3df86699
authored
8月 02, 2023
作者:
张国庆
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加列表滚动方法
上级
fdb15da7
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
31 行增加
和
56 行删除
+31
-56
CHANGELOG.md
CHANGELOG.md
+5
-2
sample.dart
example/lib/sample.dart
+0
-14
device_utils.dart
lib/utils/device_utils.dart
+0
-36
base_list_widget.dart
lib/widget/base_list_widget.dart
+23
-0
pubspec.yaml
pubspec.yaml
+3
-4
没有找到文件。
CHANGELOG.md
浏览文件 @
3df86699
...
...
@@ -11,4 +11,8 @@
## 1.0.6
*
修改ImageWidget 逻辑 增加缓存方法,加载网络图不使用 任何装饰圆角等
## 1.0.7
*
修改列表因为网络问题无法显示异常提示布局问题
\ No newline at end of file
*
修改列表因为网络问题无法显示异常提示布局问题
## 1.0.8
*
列表控件:BaseConroller 增加滚动到某一位置的方法
*
移除获取设备id的git依赖
*
升级dio版本 5.1.3
example/lib/sample.dart
浏览文件 @
3df86699
import
'package:flutter/material.dart'
;
import
'package:flutter_clx_base/flutter_clx_base.dart'
;
import
'package:flutter_clx_base/utils/device_utils.dart'
;
import
'package:flutter_clx_base/widget/normal_dialog.dart'
;
import
'package:flutter_clx_base_example/sample/base_list_widget_test.dart'
;
import
'package:flutter_clx_base_example/sample/dio_widget_test.dart'
;
...
...
@@ -36,19 +35,6 @@ class Sample extends StatelessWidget {
permissionList:
[
Permission
.
camera
],
toSettingTip:
"请开启相机权限"
);
},
text:
'动态申请权限'
),
GFButton
(
fullWidthButton:
true
,
onPressed:
()
async
{
var
deviceModel
=
await
DeviceUtils
.
getDeviceModel
();
var
versionName
=
await
DeviceUtils
.
getVersionName
();
var
versionCode
=
await
DeviceUtils
.
getVersionCode
();
var
deviceSerial
=
await
DeviceUtils
.
getDeviceSerial
();
debugPrint
(
"===== deviceModel =
$deviceModel
"
" versionName =
$versionName
"
" versionCode =
$versionCode
"
" deviceSerial =
$deviceSerial
"
);
},
text:
'获取设备信息'
),
GFButton
(
fullWidthButton:
true
,
onPressed:
()
=>
Get
.
to
(
const
ScrollViewPage
()),
...
...
lib/utils/device_utils.dart
deleted
100644 → 0
浏览文件 @
fdb15da7
import
'dart:io'
;
import
'package:device_id_plugin/device_id_plugin.dart'
;
import
'package:device_info_plus/device_info_plus.dart'
;
import
'package:flutter_clx_base/flutter_clx_base.dart'
;
class
DeviceUtils
{
//uuid
static
getDeviceSerial
()
async
{
DeviceIdPlugin
deviceInfo
=
DeviceIdPlugin
();
return
await
deviceInfo
.
getDeviceId
();
}
static
getVersionName
()
async
{
PackageInfo
packageInfo
=
await
PackageInfo
.
fromPlatform
();
return
packageInfo
.
version
;
}
static
getVersionCode
()
async
{
PackageInfo
packageInfo
=
await
PackageInfo
.
fromPlatform
();
return
packageInfo
.
buildNumber
.
toInt
();
}
static
getDeviceModel
()
async
{
DeviceInfoPlugin
deviceInfo
=
DeviceInfoPlugin
();
if
(
Platform
.
isAndroid
)
{
AndroidDeviceInfo
androidInfo
=
await
deviceInfo
.
androidInfo
;
return
androidInfo
.
model
;
}
else
{
IosDeviceInfo
iosInfo
=
await
deviceInfo
.
iosInfo
;
return
iosInfo
.
name
;
}
}
}
lib/widget/base_list_widget.dart
浏览文件 @
3df86699
...
...
@@ -67,6 +67,7 @@ class _BaseListWidgetState extends State<BaseListWidget> {
final
footer
=
buildFooter
();
return
EasyRefresh
(
controller:
_controller
.
c
,
scrollController:
_controller
.
sc
,
refreshOnStart:
widget
.
refreshOnStart
,
header:
header
,
footer:
footer
,
...
...
@@ -268,6 +269,7 @@ class _BaseListWidgetState extends State<BaseListWidget> {
// 列表控制器
class
BaseListController
{
late
EasyRefreshController
_controller
;
late
ScrollController
_scrollController
;
_BaseListWidgetState
?
_listState
;
// listState
/// Binding with BaseListWidget state
...
...
@@ -280,6 +282,7 @@ class BaseListController {
controlFinishRefresh:
true
,
controlFinishLoad:
true
,
);
_scrollController
=
ScrollController
();
}
void
finishRefresh
()
{
...
...
@@ -305,7 +308,27 @@ class BaseListController {
_listState
?.
notifySingleItem
(
index
,
item
);
}
// 滚动到某个item index 位置
void
scrollToIndex
(
int
index
,
double
height
,
{
bool
animated
=
true
,
milliseconds
=
300
,
})
{
if
(!
animated
)
{
_scrollController
.
jumpTo
(
index
*
height
);
return
;
}
_scrollController
.
animateTo
(
index
*
height
,
duration:
Duration
(
milliseconds:
milliseconds
),
curve:
Curves
.
easeOut
,
);
}
get
c
=>
_controller
;
get
sc
=>
_scrollController
;
}
typedef
SuccessCallback
=
Function
(
List
?
list
);
...
...
pubspec.yaml
浏览文件 @
3df86699
...
...
@@ -13,7 +13,7 @@ dependencies:
flutter_localizations
:
sdk
:
flutter
# dio https://pub.dev/packages/dio
dio
:
^5.
1
.1
dio
:
^5.
3
.1
# 时间选择器 https://pub.dev/packages/flutter_cupertino_datetime_picker
flutter_cupertino_datetime_picker
:
^3.0.0
# 键盘工具类 https://pub.dev/packages/keyboard_actions
...
...
@@ -60,9 +60,8 @@ dependencies:
unique_identifier
:
^0.3.0
# 设备信息 https://pub.dev/packages/device_info_plus
device_info_plus
:
^8.1.0
#获取设备id https://t.clxkj:cn/openSourceLibrary/device_id_plugin:git:
device_id_plugin
:
git
:
https://t.clxkj.cn/openSourceLibrary/device_id_plugin.git
#获取设备id https://t.clxkj:cn/openSourceLibrary/device_id_plugin.git
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论