diff options
author | Felipe Erias <felipeerias@igalia.com> | 2021-11-26 15:26:05 +0900 |
---|---|---|
committer | Felipe Erias <felipeerias@igalia.com> | 2021-11-26 15:26:05 +0900 |
commit | e1a0e2921bc80807fc0dc73cca77be9bdb2f6b33 (patch) | |
tree | 2db930cc2a7be7f3945253dc692e04e1f5f493f4 /lib/widget_clock.dart | |
parent | df52cca7ddb759f01bb1e96037a88f058e7e23e7 (diff) |
Colors and layouts; add tab tor 3D example
Diffstat (limited to 'lib/widget_clock.dart')
-rw-r--r-- | lib/widget_clock.dart | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/widget_clock.dart b/lib/widget_clock.dart index c66a659..27baff2 100644 --- a/lib/widget_clock.dart +++ b/lib/widget_clock.dart @@ -5,8 +5,10 @@ import 'package:intl/intl.dart'; class ClockWiddget extends StatefulWidget { final double size; + final Color textColor; - const ClockWiddget({Key? key, required this.size}) : super(key: key); + const ClockWiddget({Key? key, required this.size, required this.textColor}) + : super(key: key); @override _ClockWiddgetState createState() => _ClockWiddgetState(); @@ -16,6 +18,7 @@ class _ClockWiddgetState extends State<ClockWiddget> { late Timer _timer; DateTime _now = DateTime.now(); + @override void initState() { _now = DateTime.now(); @@ -38,6 +41,10 @@ class _ClockWiddgetState extends State<ClockWiddget> { @override Widget build(BuildContext context) { + TextStyle? textStyle = Theme.of(context) + .textTheme + .headline2 + ?.copyWith(color: widget.textColor); return Container( height: widget.size, padding: EdgeInsets.all(16.0), @@ -54,7 +61,7 @@ class _ClockWiddgetState extends State<ClockWiddget> { fit: BoxFit.contain, child: Text( DateFormat('EEEE').format(_now), - style: Theme.of(context).textTheme.headline2, + style: textStyle, ), ), const Divider(thickness: 1), @@ -62,7 +69,7 @@ class _ClockWiddgetState extends State<ClockWiddget> { fit: BoxFit.contain, child: Text( DateFormat.jm().format(_now), - style: Theme.of(context).textTheme.headline2, + style: textStyle, ), ), ], |