Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2. import 'counter_bloc.dart';
  3. import 'counter.dart';
  4. import 'counter_provider.dart';
  5.  
  6. class BlocPage extends StatefulWidget {
  7. @override
  8. _BlocPageState createState() => _BlocPageState();
  9. }
  10.  
  11. class _BlocPageState extends State<BlocPage> {
  12. void incrementCounter() {
  13. bloc.updateCount();
  14. }
  15.  
  16. void decrementCounter() {
  17. bloc.minCount();
  18. }
  19.  
  20. @override
  21. Widget build(BuildContext context) {
  22. return Scaffold(
  23. appBar: AppBar(
  24. title: Text("Block Pattern"),
  25. ),
  26. body: Column(
  27. children: <Widget>[
  28. Counter(),
  29. RaisedButton(
  30. child: Text("-"),
  31. onPressed: (){
  32.  
  33. decrementCounter();
  34.  
  35. },
  36. )
  37. ],
  38. ),
  39. floatingActionButton: FloatingActionButton(
  40. onPressed: incrementCounter,
  41. child: Icon(Icons.add),
  42. ),
  43.  
  44. );
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement