Pull the basic card types out into their own file for possible reuse.
This commit is contained in:
87
lib/widgets/cards.dart
Normal file
87
lib/widgets/cards.dart
Normal file
@ -0,0 +1,87 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class TitleCard extends StatelessWidget {
|
||||
const TitleCard({
|
||||
super.key,
|
||||
required this.title,
|
||||
});
|
||||
|
||||
final String title;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Center(
|
||||
child: Text(
|
||||
title,
|
||||
style: TextStyle(fontSize: 20),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class SummaryCard extends StatelessWidget {
|
||||
const SummaryCard({
|
||||
super.key,
|
||||
required this.name,
|
||||
required this.leftText,
|
||||
required this.middleText,
|
||||
required this.rightText,
|
||||
});
|
||||
|
||||
final String name;
|
||||
final String leftText;
|
||||
final String middleText;
|
||||
final String rightText;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
color: Theme.of(context).cardColor,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Card(
|
||||
color: Theme.of(context).highlightColor,
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
name,
|
||||
style: TextStyle(
|
||||
decoration: TextDecoration.underline,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Spacer(
|
||||
flex: 3,
|
||||
),
|
||||
Text(
|
||||
leftText,
|
||||
),
|
||||
Spacer(
|
||||
flex: 1,
|
||||
),
|
||||
Text(
|
||||
middleText,
|
||||
),
|
||||
Spacer(
|
||||
flex: 1,
|
||||
),
|
||||
Text(
|
||||
rightText,
|
||||
),
|
||||
Spacer(
|
||||
flex: 3,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user