Added some basic widgets

This commit is contained in:
Tyler Wilcox 2025-05-20 09:21:13 -04:00
parent 5d935db33b
commit bdf69276ad
4 changed files with 76 additions and 15 deletions

View File

@ -29,7 +29,7 @@ class MyApp extends StatelessWidget {
// //
// This works for code too, not just values: Most code changes can be // This works for code too, not just values: Most code changes can be
// tested with just a hot reload. // tested with just a hot reload.
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue, brightness: Brightness.dark),
), ),
home: const Dashboard(), home: const Dashboard(),
); );

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:helm/widgets/base_card.dart';
import '../widgets/text_card.dart'; import '../widgets/text_card.dart';
class Dashboard extends StatelessWidget { class Dashboard extends StatelessWidget {
@ -22,7 +23,24 @@ class Dashboard extends StatelessWidget {
// the App.build method, and use it to set our appbar title. // the App.build method, and use it to set our appbar title.
title: Text("Helm"), title: Text("Helm"),
), ),
body: Column(children: <Widget>[TextCard(cardTitle: 'My Card')]), body: Column(
children: <Widget>[
Row(
children: [
BaseCard(cardTitle: "Reef Picker", height: 4, width: 6),
Column(
children: [
TextCard(cardTitle: 'Match State', height: 2, width: 3),
TextCard(cardTitle: "Match Time", height: 2, width: 3),
],
),
],
),
Row(children: [
TextCard(cardTitle: "Intake State", height: 2, width: 3,)
],)
],
),
); );
} }
} }

View File

@ -0,0 +1,38 @@
import 'package:flutter/material.dart';
class BaseCard extends StatelessWidget {
const BaseCard({
super.key,
required this.cardTitle,
this.children = const [],
this.height = 1,
this.width = 1,
});
final List<Widget> children;
final String cardTitle;
final int width, height;
@override
Widget build(BuildContext context) {
return Card(
child: Padding(
padding: EdgeInsets.all(10),
child: SizedBox(
width: 100.0 * width,
height: 100.0 * height,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(cardTitle),
SizedBox(width: 100, height: 10),
] + children,
),
),
),
);
}
}

View File

@ -1,9 +1,19 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import './base_card.dart';
class TextCard extends StatefulWidget { class TextCard extends StatefulWidget {
const TextCard({super.key, required this.cardTitle}); const TextCard({
super.key,
required this.cardTitle,
this.ntTopic,
this.height = 1,
this.width = 1,
});
final String cardTitle; final String cardTitle;
final String? ntTopic;
final int width, height;
@override @override
State<TextCard> createState() => _TextCardState(); State<TextCard> createState() => _TextCardState();
@ -12,18 +22,13 @@ class TextCard extends StatefulWidget {
class _TextCardState extends State<TextCard> { class _TextCardState extends State<TextCard> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Card( return BaseCard(
child: Padding( cardTitle: widget.cardTitle,
padding: EdgeInsets.all(10), width: widget.width,
child: Column( height: widget.height,
crossAxisAlignment: CrossAxisAlignment.center, children: [
children: <Widget>[ Text("WAHOOOO")
Text(widget.cardTitle), ],
SizedBox(width: 100, height: 10),
Text("THE COOL TEXT"),
],
),
),
); );
} }
} }