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.
|
|
import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:my_flutter_puzzle/providers.dart';
class TimerTestScreen extends ConsumerWidget { const TimerTestScreen({Key? key}) : super(key: key);
@override Widget build(BuildContext context, WidgetRef ref) { final state = ref.watch(timerNotifierProvider);
return Scaffold( body: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Text(state), ElevatedButton( onPressed: () => ref.read(timerNotifierProvider.notifier).startTimer(), child: const Text('Start timer'), ), ElevatedButton( onPressed: () => ref.read(timerNotifierProvider.notifier).stopTimer(), child: const Text('Stop timer'), ), ], ), ); } }
|