Skip to content

Instantly share code, notes, and snippets.

@chimon2000
Created July 16, 2020 06:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chimon2000/13c5046a5daea988488eb2231f4d1211 to your computer and use it in GitHub Desktop.
Save chimon2000/13c5046a5daea988488eb2231f4d1211 to your computer and use it in GitHub Desktop.
counter_page.dart
class CounterPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Counter')),
body: BlocBuilder<CounterCubit, int>(
builder: (context, count) => Center(child: Text('$count')),
),
floatingActionButton: FloatingActionButton(
child: const Icon(Icons.add),
onPressed: () => context.bloc<CounterCubit>().increment(),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment