常规自定义组件(案例一)
1.先上效果图
2.关键代码如下
1.代码抽取
/// describe
///
/// created by hujintao
/// created at 2019-12-09
//
import 'package:flutter/material.dart';
typedef OnToggle = void Function(int index);
class ToggleSwitch extends StatefulWidget {
final Color activeBgColor;
final Color activeTextColor;
final Color inactiveBgColor;
final Color inactiveTextColor;
final List<String> labels;
final double cornerRadius;
final OnToggle onToggle;
final int initialLabelIndex;
final double minWidth;
final List<IconData> icons;
final List<Color> activeColors;
ToggleSwitch({
Key key,
@required this.activeBgColor,
@required this.activeTextColor,
@required this.inactiveBgColor,
@required this.inactiveTextColor,
@required this.labels,
this.onToggle,
this.cornerRadius = 8.0,
this.initialLabelIndex = 0,
this.minWidth = 72,
this.icons,
this.activeColors,
}) : super(key: key);
@override
_ToggleSwitchState createState() => _ToggleSwitchState();
}
class _ToggleSwitchState extends State<ToggleSwitch>
with AutomaticKeepAliveClientMixin<ToggleSwitch> {
int current;
@override
void initState() {
current = widget.initialLabelIndex;
super.initState();
}
@override
bool get wantKeepAlive => true;
@override
Widget build(BuildContext context) {
super.build(context);
return ClipRRect(
borderRadius: BorderRadius.circular(widget.cornerRadius),
child: Container(
height: 40,
color: widget.inactiveBgColor,
child: Row(
mainAxisSize: MainAxisSize.min,
children: List.generate(widget.labels.length * 2 - 1, (index) {
final active = index ~/ 2 == current;
final textColor =
active ? widget.activeTextColor : widget.inactiveTextColor;
var bgColor = Colors.transparent;
if (active) {
bgColor = widget.activeColors == null
? widget.activeBgColor
: widget.activeColors[index ~/ 2];
}
if (index % 2 == 1) {
final activeDivider = active || index ~/ 2 == current - 1;
return Container(
width: 1,
color: activeDivider ? widget.activeBgColor : Colors.white30,
margin: EdgeInsets.symmetric(vertical: activeDivider ? 0 : 8),
);
} else {
return GestureDetector(
onTap: () => _handleOnTap(index ~/ 2),
child: Container(
constraints: BoxConstraints(minWidth: widget.minWidth),
alignment: Alignment.center,
color: bgColor,
child: widget.icons == null
? Text(widget.labels[index ~/ 2],
style: TextStyle(color: textColor))
: Row(
children: <Widget>[
Icon(widget.icons[index ~/ 2],
color: textColor, size: 17.0),
Padding(
padding: const EdgeInsets.only(left: 5.0),
child: Text(widget.labels[index ~/ 2],
style: TextStyle(color: textColor)))
],
),
),
);
}
}),
),
),
);
}
void _handleOnTap(int index) async {
setState(() => current = index);
if (widget.onToggle != null) {
widget.onToggle(index);
}
}
}
2.代码使用
ToggleSwitch(
initialLabelIndex: 1,
minWidth: ScreenUtil().setWidth(180),
cornerRadius: ScreenUtil().setWidth(70),
activeBgColor: Color(0xffED9CBE),
activeTextColor: Colors.white,
inactiveBgColor: Color(0xffF3F4F5),
inactiveTextColor: Color(0xff999999),
labels: ['匹配历史', '匹配CP'],
onToggle: (index) {
print('switched to: $index');
}),
组件使用简介~
-
minWidth
设置最小宽度 -
cornerRadius
设置圆角 -
activeBgColor
设置高亮时的背景颜色 -
activeTextColor
设置高亮时的字体颜色 -
inactiveBgColor
设置常规背景颜色 -
inactiveTextColor
设置常规字体颜色 -
labels
设置标题数组 -
onToggle
拨动回调方法
自定义Switch案例二(带圆角滑块)
1.先上效果图
2.实现思路
- 最外层布局
Stack
- 底部写一个
Container
背景组件(Widget) - 通过
AnimatedPositioned
实现滑块效果- 设置left或者right
- 滑动或者点击实现过渡动画
- 实现滑动底部列表或者点击顶部Tab即可实现滑动滑动效果
3.关键代码
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:fpdxapp/components/custom_appbar.dart';
import 'package:fpdxapp/components/switch/toggle.dart';
import 'package:fpdxapp/components/vip_tag.dart';
import 'package:fpdxapp/model/im/im.dart';
import 'package:fpdxapp/utils/screen.dart';
import 'package:fpdxapp/utils/toast.dart';
import 'package:fpdxapp/utils/utils.dart';
class MatchingPage extends StatefulWidget {
@override
_MatchingPageState createState() => _MatchingPageState();
}
class _MatchingPageState extends State<MatchingPage> {
int index = 1;
ListFriendConversationModel currentItem = ListFriendConversationModel();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: CustomAppbar.appBar(
context,
title: '匹配CP|匹配历史',
theme: CustomAppbarTheme.white,
),
body: MatchingWidget(),
);
}
}
class MatchingWidget extends StatefulWidget {
@override
_MatchingWidgetState createState() => _MatchingWidgetState();
}
class _MatchingWidgetState extends State<MatchingWidget> {
final _controller = new PageController();
final int pageSwitchAnimatedTime = 200;
double centerPoint = ScreenUtil().setWidth(318) / 2;
double value = ScreenUtil().setWidth(318) / 2;
final List<Widget> _pages = <Widget>[
MatchCp(),
MatchHistory(),
];
int currentIndex = 1;
@override
Widget build(BuildContext context) {
return Container(
child: SafeArea(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
//主题Body
Container(
child: Column(
children: <Widget>[
// 切换Tab
Center(
child: Stack(
children: <Widget>[
// 主题
GestureDetector(
child: Container(
width: ScreenUtil().setWidth(318),
height: 40,
decoration: BoxDecoration(
color: Color(0xffF3F4F5),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(70),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Text(
'匹配历史',
style: TextStyle(
color: Color(0xff999999),
fontSize: ScreenUtil().setSp(28),
),
),
Text(
'匹配CP',
style: TextStyle(
color: Color(0xff999999),
fontSize: ScreenUtil().setSp(28),
),
),
],
),
),
onTap: () {
print('this.value=========>${this.value}');
if (this.value == 0.0) {
this.value = ScreenUtil().setWidth(318) / 2;
currentIndex = 1;
} else {
currentIndex = 0;
this.value = 0.0;
}
//print("currentIndex=============${currentIndex}");
_controller.animateToPage(currentIndex == 0 ? 1 : 0,
duration: Duration(
milliseconds: (pageSwitchAnimatedTime + 100)),
curve: Curves.ease);
setState(() {});
},
),
// 滑块
AnimatedPositioned(
left: this.value,
duration:
Duration(milliseconds: pageSwitchAnimatedTime),
child: Container(
width: ScreenUtil().setWidth(160),
height: 40,
decoration: BoxDecoration(
color: Color(0xffED9CBE),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(70)),
),
child: Center(
child: Text(
currentIndex == 1 ? '匹配CP' : '匹配历史',
style: TextStyle(
color: Colors.white,
fontSize: ScreenUtil().setSp(28),
),
),
),
),
),
],
),
),
// 匹配-Part
Container(
child: PageView.builder(
physics: new AlwaysScrollableScrollPhysics(),
controller: _controller,
itemBuilder: (BuildContext context, int index) {
return _pages[index];
},
//条目个数
itemCount: _pages.length,
onPageChanged: (int index) {
currentIndex = index == 0 ? 1 : 0;
this.value = currentIndex == 1
? ScreenUtil().setWidth(318) / 2
: 0.0;
setState(() {});
},
),
height: 500,
),
],
),
margin: EdgeInsets.only(top: ScreenUtil().setWidth(40)),
),
// 底部描述
Container(
margin: EdgeInsets.only(bottom: ScreenUtil().setWidth(37)),
child: Text(
'—— 到这儿刚刚好 ——',
style: TextStyle(
color: Color(0xff999999), fontSize: ScreenUtil().setSp(24)),
),
),
],
)),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
offset: Offset(0, -ScreenUtil().setWidth(3)),
blurRadius: ScreenUtil().setWidth(6),
spreadRadius: ScreenUtil().setWidth(6),
color: Colors.black.withOpacity(0.03),
),
],
),
);
}
}
class MatchHistory extends StatelessWidget {
ListFriendConversationModel currentItem = ListFriendConversationModel();
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
_matching(currentItem),
_matchSucceed(currentItem),
_matchFailed(currentItem),
],
);
}
/// 匹配中
Widget _matching(ListFriendConversationModel currentItem) {
return Column(
children: <Widget>[
// 主题部分
Container(
color: Colors.transparent,
width: Screen.width,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(20),
right: ScreenUtil().setWidth(16),
top: ScreenUtil().setHeight(20),
bottom: ScreenUtil().setHeight(20)),
//color: Colors.green,
child: Container(
child: Row(
children: <Widget>[
Expanded(
child: Row(
children: <Widget>[
// 左边icon 部分
Container(
width: ScreenUtil().setWidth(120),
height: ScreenUtil().setWidth(120),
decoration: BoxDecoration(
color: Color(0xffFFF2F4),
border:
new Border.all(width: 2.0, color: Colors.white),
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(120))),
boxShadow: [
BoxShadow(
offset: Offset(0, 0),
blurRadius: ScreenUtil().setWidth(7),
color: Color(0xffC4566F).withOpacity(0.13),
),
],
),
child: Container(
margin: EdgeInsets.all(2),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(151))),
),
child: Center(
child: Image(
image:
Utils.getAssetImgWithPath('matching_in_cp'),
width: ScreenUtil().setWidth(70),
),
),
),
),
// 文字部分
Expanded(
child: Container(
margin:
EdgeInsets.only(left: ScreenUtil().setWidth(15)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Text(
'匹配中',
style: TextStyle(
fontSize: ScreenUtil().setSp(30),
color: Color(0xffFF7E98)),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
Padding(
padding: const EdgeInsets.only(left: 5),
child: VipTag(
currentItem.user?.beVipAt ?? 0,
currentItem.user?.supvipEndAt ?? 0,
currentItem.user?.wxAuth),
)
],
),
SizedBox(
height: ScreenUtil().setHeight(4),
),
Text(
'请于8月08日查询匹配结果',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: Color(0xFFAAAAAA)),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
],
),
),
),
],
),
),
// 箭头角标
Container(
child: Icon(
Icons.arrow_forward_ios,
size: ScreenUtil().setSp(28),
color: Color(0xff999999),
),
margin: EdgeInsets.only(right: ScreenUtil().setWidth(20)),
),
],
),
),
),
// 分割线
Container(
child: Divider(
height: ScreenUtil().setHeight(2),
indent: ScreenUtil().setWidth(150),
endIndent: ScreenUtil().setWidth(30),
color: Color(0xffEEEEEE),
),
margin: EdgeInsets.only(bottom: 1),
),
],
);
}
/// 匹配成功
Widget _matchSucceed(ListFriendConversationModel currentItem) {
return Column(
children: <Widget>[
// 主题部分
Container(
color: Colors.transparent,
width: Screen.width,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(20),
right: ScreenUtil().setWidth(16),
top: ScreenUtil().setHeight(20),
bottom: ScreenUtil().setHeight(20)),
//color: Colors.green,
child: Container(
child: Row(
children: <Widget>[
Expanded(
child: Row(
children: <Widget>[
// 左边icon 部分
Container(
width: ScreenUtil().setWidth(120),
height: ScreenUtil().setWidth(120),
decoration: BoxDecoration(
color: Color(0xffFFE7EC),
border: new Border.all(
width: 2.0, color: Color(0xffFA8396)),
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(120))),
),
child: Container(
margin: EdgeInsets.all(2),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(151))),
image: DecorationImage(
image: NetworkImage(
'https://dss1.bdstatic.com/6OF1bjeh1BF3odCf/it/u=4023145134,3753224785&fm=74&app=80&f=JPEG&size=f121,90?sec=1880279984&t=49fe2a9b312d6f606c1dab71efc9b252'),
fit: BoxFit.cover),
),
),
),
// 文字部分
Expanded(
child: Container(
margin:
EdgeInsets.only(left: ScreenUtil().setWidth(15)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Text(
'小壳儿',
style: TextStyle(
fontSize: ScreenUtil().setSp(30),
color: Color(0xff333333)),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
Padding(
padding: const EdgeInsets.only(left: 5),
child: VipTag(
currentItem.user?.beVipAt ?? 0,
currentItem.user?.supvipEndAt ?? 0,
currentItem.user?.wxAuth),
)
],
),
SizedBox(
height: ScreenUtil().setHeight(4),
),
Text(
'51期匹配CP',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: Color(0xFFAAAAAA)),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
],
),
),
),
],
),
),
// 箭头角标
Container(
child: Icon(
Icons.arrow_forward_ios,
size: ScreenUtil().setSp(28),
color: Color(0xff999999),
),
margin: EdgeInsets.only(right: ScreenUtil().setWidth(20)),
),
],
),
),
),
// 分割线
Container(
child: Divider(
height: ScreenUtil().setHeight(2),
indent: ScreenUtil().setWidth(150),
endIndent: ScreenUtil().setWidth(30),
color: Color(0xffEEEEEE),
),
margin: EdgeInsets.only(bottom: 1),
),
],
);
}
/// 匹配失败
Widget _matchFailed(ListFriendConversationModel currentItem) {
return Column(
children: <Widget>[
// 主题部分
Container(
color: Colors.transparent,
width: Screen.width,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(20),
right: ScreenUtil().setWidth(16),
top: ScreenUtil().setHeight(20),
bottom: ScreenUtil().setHeight(20)),
//color: Colors.green,
child: Container(
child: Row(
children: <Widget>[
Expanded(
child: Row(
children: <Widget>[
// 左边icon 部分
Container(
width: ScreenUtil().setWidth(120),
height: ScreenUtil().setWidth(120),
decoration: BoxDecoration(
color: Color(0xffF3F4F5),
border:
new Border.all(width: 2.0, color: Colors.white),
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(120))),
boxShadow: [
BoxShadow(
offset: Offset(0, 0),
blurRadius: ScreenUtil().setWidth(7),
color: Color(0xffC4566F).withOpacity(0.13),
),
],
),
child: Container(
margin: EdgeInsets.all(2),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(151))),
),
child: Center(
child: Image(
image:
Utils.getAssetImgWithPath('matching_fail_cp'),
width: ScreenUtil().setWidth(60),
),
),
),
),
// 文字部分
Expanded(
child: Container(
margin:
EdgeInsets.only(left: ScreenUtil().setWidth(15)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Text(
'匹配失败',
style: TextStyle(
fontSize: ScreenUtil().setSp(30),
color: Color(0xff999999)),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
Padding(
padding: const EdgeInsets.only(left: 5),
child: VipTag(
currentItem.user?.beVipAt ?? 0,
currentItem.user?.supvipEndAt ?? 0,
currentItem.user?.wxAuth),
)
],
),
SizedBox(
height: ScreenUtil().setHeight(4),
),
Text(
'已报名下一期分配对象',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: Color(0xFFDEDEDE)),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
],
),
),
),
],
),
),
],
),
),
),
// 分割线
Container(
child: Divider(
height: ScreenUtil().setHeight(2),
indent: ScreenUtil().setWidth(150),
endIndent: ScreenUtil().setWidth(30),
color: Color(0xffEEEEEE),
),
margin: EdgeInsets.only(bottom: 1),
),
],
);
}
}
class MatchCp extends StatelessWidget {
ListFriendConversationModel currentItem = ListFriendConversationModel();
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
_matchSucceed(currentItem),
_matchSucceed(currentItem),
],
);
}
/// 匹配中
Widget _matching(ListFriendConversationModel currentItem) {
return Column(
children: <Widget>[
// 主题部分
Container(
color: Colors.transparent,
width: Screen.width,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(20),
right: ScreenUtil().setWidth(16),
top: ScreenUtil().setHeight(20),
bottom: ScreenUtil().setHeight(20)),
//color: Colors.green,
child: Container(
child: Row(
children: <Widget>[
Expanded(
child: Row(
children: <Widget>[
// 左边icon 部分
Container(
width: ScreenUtil().setWidth(120),
height: ScreenUtil().setWidth(120),
decoration: BoxDecoration(
color: Color(0xffFFF2F4),
border:
new Border.all(width: 2.0, color: Colors.white),
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(120))),
boxShadow: [
BoxShadow(
offset: Offset(0, 0),
blurRadius: ScreenUtil().setWidth(7),
color: Color(0xffC4566F).withOpacity(0.13),
),
],
),
child: Container(
margin: EdgeInsets.all(2),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(151))),
),
child: Center(
child: Image(
image:
Utils.getAssetImgWithPath('matching_in_cp'),
width: ScreenUtil().setWidth(70),
),
),
),
),
// 文字部分
Expanded(
child: Container(
margin:
EdgeInsets.only(left: ScreenUtil().setWidth(15)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Text(
'匹配中',
style: TextStyle(
fontSize: ScreenUtil().setSp(30),
color: Color(0xffFF7E98)),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
Padding(
padding: const EdgeInsets.only(left: 5),
child: VipTag(
currentItem.user?.beVipAt ?? 0,
currentItem.user?.supvipEndAt ?? 0,
currentItem.user?.wxAuth),
)
],
),
SizedBox(
height: ScreenUtil().setHeight(4),
),
Text(
'请于8月08日查询匹配结果',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: Color(0xFFAAAAAA)),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
],
),
),
),
],
),
),
// 箭头角标
Container(
child: Icon(
Icons.arrow_forward_ios,
size: ScreenUtil().setSp(28),
color: Color(0xff999999),
),
margin: EdgeInsets.only(right: ScreenUtil().setWidth(20)),
),
],
),
),
),
// 分割线
Container(
child: Divider(
height: ScreenUtil().setHeight(2),
indent: ScreenUtil().setWidth(150),
endIndent: ScreenUtil().setWidth(30),
color: Color(0xffEEEEEE),
),
margin: EdgeInsets.only(bottom: 1),
),
],
);
}
/// 匹配成功
Widget _matchSucceed(ListFriendConversationModel currentItem) {
return Column(
children: <Widget>[
// 主题部分
Container(
color: Colors.transparent,
width: Screen.width,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(20),
right: ScreenUtil().setWidth(16),
top: ScreenUtil().setHeight(20),
bottom: ScreenUtil().setHeight(20)),
//color: Colors.green,
child: Container(
child: Row(
children: <Widget>[
Expanded(
child: Row(
children: <Widget>[
// 左边icon 部分
Container(
width: ScreenUtil().setWidth(120),
height: ScreenUtil().setWidth(120),
decoration: BoxDecoration(
color: Color(0xffFFE7EC),
border: new Border.all(
width: 2.0, color: Color(0xffFA8396)),
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(120))),
),
child: Container(
margin: EdgeInsets.all(2),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(151))),
image: DecorationImage(
image: NetworkImage(
'https://dss1.bdstatic.com/6OF1bjeh1BF3odCf/it/u=4023145134,3753224785&fm=74&app=80&f=JPEG&size=f121,90?sec=1880279984&t=49fe2a9b312d6f606c1dab71efc9b252'),
fit: BoxFit.cover),
),
),
),
// 文字部分
Expanded(
child: Container(
margin:
EdgeInsets.only(left: ScreenUtil().setWidth(15)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Text(
'小壳儿',
style: TextStyle(
fontSize: ScreenUtil().setSp(30),
color: Color(0xff333333)),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
Padding(
padding: const EdgeInsets.only(left: 5),
child: VipTag(
currentItem.user?.beVipAt ?? 0,
currentItem.user?.supvipEndAt ?? 0,
currentItem.user?.wxAuth),
)
],
),
SizedBox(
height: ScreenUtil().setHeight(4),
),
Text(
'51期匹配CP',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: Color(0xFFAAAAAA)),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
],
),
),
),
],
),
),
// 箭头角标
Container(
child: Icon(
Icons.arrow_forward_ios,
size: ScreenUtil().setSp(28),
color: Color(0xff999999),
),
margin: EdgeInsets.only(right: ScreenUtil().setWidth(20)),
),
],
),
),
),
// 分割线
Container(
child: Divider(
height: ScreenUtil().setHeight(2),
indent: ScreenUtil().setWidth(150),
endIndent: ScreenUtil().setWidth(30),
color: Color(0xffEEEEEE),
),
margin: EdgeInsets.only(bottom: 1),
),
],
);
}
/// 匹配失败
Widget _matchFailed(ListFriendConversationModel currentItem) {
return Column(
children: <Widget>[
// 主题部分
Container(
color: Colors.transparent,
width: Screen.width,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(20),
right: ScreenUtil().setWidth(16),
top: ScreenUtil().setHeight(20),
bottom: ScreenUtil().setHeight(20)),
//color: Colors.green,
child: Container(
child: Row(
children: <Widget>[
Expanded(
child: Row(
children: <Widget>[
// 左边icon 部分
Container(
width: ScreenUtil().setWidth(120),
height: ScreenUtil().setWidth(120),
decoration: BoxDecoration(
color: Color(0xffF3F4F5),
border:
new Border.all(width: 2.0, color: Colors.white),
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(120))),
boxShadow: [
BoxShadow(
offset: Offset(0, 0),
blurRadius: ScreenUtil().setWidth(7),
color: Color(0xffC4566F).withOpacity(0.13),
),
],
),
child: Container(
margin: EdgeInsets.all(2),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(151))),
),
child: Center(
child: Image(
image:
Utils.getAssetImgWithPath('matching_fail_cp'),
width: ScreenUtil().setWidth(60),
),
),
),
),
// 文字部分
Expanded(
child: Container(
margin:
EdgeInsets.only(left: ScreenUtil().setWidth(15)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Text(
'匹配失败',
style: TextStyle(
fontSize: ScreenUtil().setSp(30),
color: Color(0xff999999)),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
Padding(
padding: const EdgeInsets.only(left: 5),
child: VipTag(
currentItem.user?.beVipAt ?? 0,
currentItem.user?.supvipEndAt ?? 0,
currentItem.user?.wxAuth),
)
],
),
SizedBox(
height: ScreenUtil().setHeight(4),
),
Text(
'已报名下一期分配对象',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: Color(0xFFDEDEDE)),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
],
),
),
),
],
),
),
],
),
),
),
// 分割线
Container(
child: Divider(
height: ScreenUtil().setHeight(2),
indent: ScreenUtil().setWidth(150),
endIndent: ScreenUtil().setWidth(30),
color: Color(0xffEEEEEE),
),
margin: EdgeInsets.only(bottom: 1),
),
],
);
}
}
未完-待续.