Added some basic widgets
This commit is contained in:
parent
5d935db33b
commit
bdf69276ad
|
|
@ -29,7 +29,7 @@ class MyApp extends StatelessWidget {
|
|||
//
|
||||
// This works for code too, not just values: Most code changes can be
|
||||
// tested with just a hot reload.
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue, brightness: Brightness.dark),
|
||||
),
|
||||
home: const Dashboard(),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:helm/widgets/base_card.dart';
|
||||
import '../widgets/text_card.dart';
|
||||
|
||||
class Dashboard extends StatelessWidget {
|
||||
|
|
@ -22,7 +23,24 @@ class Dashboard extends StatelessWidget {
|
|||
// the App.build method, and use it to set our appbar title.
|
||||
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,)
|
||||
],)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,19 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import './base_card.dart';
|
||||
|
||||
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? ntTopic;
|
||||
|
||||
final int width, height;
|
||||
|
||||
@override
|
||||
State<TextCard> createState() => _TextCardState();
|
||||
|
|
@ -12,18 +22,13 @@ class TextCard extends StatefulWidget {
|
|||
class _TextCardState extends State<TextCard> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(widget.cardTitle),
|
||||
SizedBox(width: 100, height: 10),
|
||||
Text("THE COOL TEXT"),
|
||||
],
|
||||
),
|
||||
),
|
||||
return BaseCard(
|
||||
cardTitle: widget.cardTitle,
|
||||
width: widget.width,
|
||||
height: widget.height,
|
||||
children: [
|
||||
Text("WAHOOOO")
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue