You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
965 B

2 years ago
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_riverpod/flutter_riverpod.dart';
  3. import 'package:my_flutter_puzzle/providers.dart';
  4. class TimerWidget extends StatelessWidget {
  5. const TimerWidget({
  6. Key? key,
  7. required this.fontSize,
  8. }) : super(key: key);
  9. final double fontSize;
  10. @override
  11. Widget build(BuildContext context) {
  12. return Row(
  13. mainAxisSize: MainAxisSize.min,
  14. children: [
  15. Consumer(
  16. builder: (context, ref, child) {
  17. final state = ref.watch(timerNotifierProvider);
  18. return Text(
  19. state,
  20. style: TextStyle(
  21. fontSize: fontSize,
  22. fontWeight: FontWeight.bold,
  23. color: Colors.white,
  24. ),
  25. );
  26. },
  27. ),
  28. const SizedBox(width: 8),
  29. Icon(
  30. Icons.timer,
  31. color: Colors.white,
  32. size: fontSize,
  33. )
  34. ],
  35. );
  36. }
  37. }