Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
F
flutter_clx_base
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
flutter_clx_base
Commits
58f321a7
提交
58f321a7
authored
8月 09, 2022
作者:
shixiaochen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1、封装SelectTextItem
上级
cfeb2f60
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
161 行增加
和
1 行删除
+161
-1
colours.dart
lib/common/colours.dart
+14
-0
flutter_clx_base.dart
lib/flutter_clx_base.dart
+2
-1
image_utils.dart
lib/utils/image_utils.dart
+23
-0
select_text_item.dart
lib/widget/select_text_item.dart
+122
-0
没有找到文件。
lib/common/colours.dart
0 → 100644
浏览文件 @
58f321a7
import
'package:flutter/material.dart'
;
const
Color
white
=
Color
(
0xFFFFFFFF
);
const
Color
black
=
Color
(
0xFF000000
);
const
Color
transparent
=
Color
(
0x00000000
);
const
Color
text000
=
Color
(
0xFF000000
);
const
Color
text21
=
Color
(
0xFF212121
);
const
Color
text333
=
Color
(
0xFF333333
);
const
Color
text666
=
Color
(
0xFF666666
);
const
Color
text888
=
Color
(
0xFF888888
);
const
Color
text999
=
Color
(
0xFF999999
);
const
Color
textCd
=
Color
(
0xFFCDCDCD
);
const
Color
textB8
=
Color
(
0xFFB8B8B8
);
lib/flutter_clx_base.dart
浏览文件 @
58f321a7
library
flutter_clx_base
;
export
'common/colours.dart'
;
export
'common/extension.dart'
;
export
'common/gaps.dart'
;
export
'
common/gap
s.dart'
;
export
'
utils/image_util
s.dart'
;
export
'widget/my_app_bar.dart'
;
export
'widget/my_scaffold.dart'
;
export
'widget/my_scroll_view.dart'
;
...
...
lib/utils/image_utils.dart
0 → 100644
浏览文件 @
58f321a7
import
'package:flutter/material.dart'
;
import
'package:flutter/widgets.dart'
;
class
ImageUtils
{
static
ImageProvider
getNetworkImage
(
String
name
,
{
String
format
=
'png'
})
{
return
NetworkImage
(
name
);
}
static
ImageProvider
getAssetImage
(
String
name
,
{
String
format
=
'png'
})
{
return
AssetImage
(
getImgPath
(
name
,
format:
format
));
}
static
String
getImgPath
(
String
?
name
,
{
String
format
=
'png'
})
{
return
'assets/images/
$name
.
$format
'
;
}
static
String
getSVGPath
(
String
name
,
{
String
format
=
'svg'
})
{
return
'assets/images/
$name
.
$format
'
;
}
}
lib/widget/select_text_item.dart
0 → 100644
浏览文件 @
58f321a7
import
'package:flutter/material.dart'
;
import
'package:flutter_clx_base/common/colours.dart'
;
import
'package:flutter_clx_base/common/gaps.dart'
;
class
SelectTextItem
extends
StatelessWidget
{
const
SelectTextItem
({
Key
?
key
,
required
this
.
title
,
this
.
titleColor
=
text999
,
this
.
titleFontSize
=
14.0
,
this
.
onTap
,
this
.
content
=
''
,
this
.
contentHint
=
'请选择'
,
this
.
contentColor
=
text000
,
this
.
contentFontSize
=
15.0
,
this
.
contentHintColor
=
textCd
,
this
.
minHeight
=
50.0
,
this
.
hPadding
=
20.0
,
this
.
hMargin
=
0.0
,
this
.
isShowRightArrow
=
true
,
this
.
backgroundColor
=
white
,
this
.
selectAlignment
=
MainAxisAlignment
.
end
,
this
.
rightImage
,
this
.
rightImageWidth
=
20.0
,
this
.
rightImageHeight
=
20.0
,
this
.
leftImage
,
this
.
leftImageWidth
,
this
.
leftImageHeight
,
})
:
super
(
key:
key
);
final
GestureTapCallback
?
onTap
;
final
String
title
;
final
Color
?
titleColor
;
final
double
?
titleFontSize
;
final
String
?
content
;
final
String
contentHint
;
final
Color
?
contentColor
;
final
double
?
contentFontSize
;
final
Color
?
contentHintColor
;
final
double
hPadding
;
final
double
hMargin
;
final
double
minHeight
;
final
bool
isShowRightArrow
;
final
ImageProvider
?
rightImage
;
final
double
?
rightImageWidth
;
final
double
?
rightImageHeight
;
final
ImageProvider
?
leftImage
;
final
double
?
leftImageWidth
;
final
double
?
leftImageHeight
;
final
Color
?
backgroundColor
;
final
MainAxisAlignment
selectAlignment
;
@override
Widget
build
(
BuildContext
context
)
{
return
InkWell
(
onTap:
onTap
,
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
hPadding
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
hMargin
),
constraints:
BoxConstraints
(
minHeight:
minHeight
),
color:
backgroundColor
,
child:
Row
(
children:
<
Widget
>[
// 左侧图标
leftImage
!=
null
?
Container
(
margin:
const
EdgeInsets
.
only
(
right:
8.0
),
child:
Image
(
image:
leftImage
!,
width:
leftImageWidth
,
height:
leftImageHeight
,
),
)
:
Container
(),
// 标题
Text
(
title
,
style:
TextStyle
(
color:
titleColor
,
fontSize:
titleFontSize
),
),
hGap16
,
Expanded
(
child:
Row
(
mainAxisAlignment:
selectAlignment
,
children:
[
// 选中内容
Text
(
content
==
null
||
content
!.
isEmpty
?
contentHint
:
content
!,
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
color:
content
==
null
||
content
!.
isEmpty
?
contentHintColor
:
contentColor
,
fontSize:
contentFontSize
,
),
),
hGap5
,
// 右侧图标
rightImage
!=
null
?
Image
(
image:
rightImage
!,
width:
rightImageWidth
,
height:
rightImageHeight
,
)
:
isShowRightArrow
?
const
Icon
(
Icons
.
arrow_forward_ios
,
color:
Colors
.
grey
,
size:
15
,
)
:
hGap15
,
],
),
),
],
),
),
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论