Skip to content

Commit

Permalink
Make match time use maximum space
Browse files Browse the repository at this point in the history
  • Loading branch information
Gold872 committed Nov 24, 2023
1 parent c32e8cf commit 07e4958
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions lib/widgets/nt4_widgets/single_topic/match_time.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:elastic_dashboard/services/globals.dart';
import 'package:elastic_dashboard/services/nt4_connection.dart';
import 'package:elastic_dashboard/widgets/nt4_widgets/nt4_widget.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class MatchTimeWidget extends StatelessWidget with NT4Widget {
@override
Expand Down Expand Up @@ -37,16 +38,32 @@ class MatchTimeWidget extends StatelessWidget with NT4Widget {

@override
Widget build(BuildContext context) {
notifier = context.watch<NT4WidgetNotifier?>();

return StreamBuilder(
stream: subscription?.periodicStream(),
initialData: nt4Connection.getLastAnnouncedValue(topic),
builder: (context, snapshot) {
double time = tryCast(snapshot.data) ?? -1.0;

return Text('${time.ceil()}',
style: Theme.of(context).textTheme.displaySmall!.copyWith(
color: _getTimeColor(time.ceil().toDouble()),
));
return Stack(
fit: StackFit.expand,
children: [
Padding(
padding: const EdgeInsets.only(bottom: 10.0),
child: FittedBox(
alignment: Alignment.center,
fit: BoxFit.contain,
child: Text(
'${time.ceil()}',
style: TextStyle(
color: _getTimeColor(time.ceil().toDouble()),
),
),
),
),
],
);
},
);
}
Expand Down

0 comments on commit 07e4958

Please sign in to comment.