Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Card timeline #1297

Merged
merged 7 commits into from
Nov 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions packages/uni_ui/lib/card_timeline.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import 'package:flutter/material.dart';

class TimelineItem extends StatelessWidget {
const TimelineItem(
{required this.startTime,
required this.endTime,
required this.card,
this.isActive = false,
super.key});

final String startTime;
final String endTime;
DGoiana marked this conversation as resolved.
Show resolved Hide resolved
final Widget card;
final bool isActive;

@override
Widget build(BuildContext context) {
return Row(crossAxisAlignment: CrossAxisAlignment.start, children: [
Container(
width: 50,
child: Column(
children: [
Text(startTime,
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18)),
Text(endTime,
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600))
],
),
),
Column(children: [
Container(
margin: EdgeInsets.only(bottom: 5, left: 10, right: 10),
width: 25,
height: 25,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: isActive ? Theme.of(context).primaryColor : Colors.white,
border: Border.all(
color: Theme.of(context).primaryColor,
width: 4.0,
),
),
child: isActive
? Center(
child: Container(
width: 20,
height: 20,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(color: Colors.white, width: 3),
)))
: null),
Container(
margin: EdgeInsets.only(bottom: 5, left: 10, right: 10),
height: 55,
width: 3,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10)),
color: Theme.of(context).primaryColor))
]),
Expanded(child: card)
]);
}
}

class CardTimeline extends StatelessWidget {
const CardTimeline({required this.items, super.key});

final List<TimelineItem> items;
@override
Widget build(BuildContext context) {
return ListView.builder(
itemCount: items.length,
itemBuilder: (context, index) => items[index],
);
}
}