如何在 flutter 中创建自定义 Timelime,如下所示:
这是我迄今为止尝试过的代码:
IntrinsicHeight(
child: Row(
children: [
Container(
width: 8.w,
height: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16.r),
gradient: const LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Color(0XFF402883),
Color(0XFF6A55EA),
Color(0XFF8F84D2),
Color(0XFFADA6D5),
],
),
),
),
SizedBox(width: 10.w),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Sign Up",
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w700,
),
),
Text(
"Create an account to invest & Trade",
style: TextStyle(
fontSize: 12.sp,
fontWeight: FontWeight.w400,
),
),
SizedBox(height: 10.h),
Text(
"Investment Order Submitted",
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w700,
),
),
Text(
"You will be charged when the company's Escrow account opens(if it hasn't already)",
style: TextStyle(
fontSize: 12.sp,
fontWeight: FontWeight.w400,
),
),
SizedBox(height: 10.h),
Text(
"Funds In Transit",
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w700,
),
),
Text(
"Your Payment method has been charged,funds should arrive in escrow in 3-5 business days.",
style: TextStyle(
fontSize: 12.sp,
fontWeight: FontWeight.w400,
),
),
SizedBox(height: 10.h),
Text(
"Funds Received",
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w700,
),
),
Text(
"Your investment finalization occurs at campaign close, potentially earlier with disbursement.",
style: TextStyle(
fontSize: 12.sp,
fontWeight: FontWeight.w400,
),
),
SizedBox(height: 10.h),
Text(
"Funds Invested",
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w700,
),
),
Text(
"Your investment is complete and can find the details and ownership docs in your portfolio.",
style: TextStyle(
fontSize: 12.sp,
fontWeight: FontWeight.w400,
),
),
],
),
),
],
),
)
我已经用上面的代码实现了这个用户界面:
现在在垂直线上添加这些点,使其与前面的标题完全对齐。
谢谢。
使用此代码:
IntrinsicHeight(
child: Row(
children: [
Container(
width: 8,
height: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
gradient: const LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Color(0XFF402883),
Color(0XFF6A55EA),
Color(0XFF8F84D2),
Color(0XFFADA6D5),
],
),
),
child: SizedBox(
height: 100,
child: ListView.separated(
shrinkWrap: true,
separatorBuilder: (context, index) => const SizedBox(
height: 60,
),
itemCount: 5,
itemBuilder: (context, index) => Container(
margin: EdgeInsets.only(
top: index == 0 ? 8 : 0, right: 2, left: 2),
height: 4,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
color: Colors.white),
),
),
),
),
const SizedBox(width: 10),
const Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Sign Up",
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w700,
),
),
Text(
"Create an account to invest & Trade",
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w400,
),
),
SizedBox(height: 10),
Text(
"Investment Order Submitted",
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w700,
),
),
Text(
"You will be charged when the company's Escrow account opens(if it hasn't already)",
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w400,
),
),
SizedBox(height: 10),
Text(
"Funds In Transit",
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w700,
),
),
Text(
"Your Payment method has been charged,funds should arrive in escrow in 3-5 business days.",
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w400,
),
),
SizedBox(height: 10),
Text(
"Funds Received",
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w700,
),
),
Text(
"Your investment finalization occurs at campaign close, potentially earlier with disbursement.",
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w400,
),
),
SizedBox(height: 10),
Text(
"Funds Invested",
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w700,
),
),
Text(
"Your investment is complete and can find the details and ownership docs in your portfolio.",
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w400,
),
),
],
),
),
],
),
),