Line data Source code
1 : import 'package:example/viewmodel/i_home_viewmodel.dart'; 2 : import 'package:flutter/material.dart'; 3 : import 'package:flutter/widgets.dart'; 4 : import 'package:stacked_mvvm/stacked_mvvm.dart'; 5 : 6 : import 'count_view.dart'; 7 : 8 : class HomeView extends IView<IHomeViewModel> { 9 2 : HomeView({Key? key}) : super(key: key); 10 : 11 1 : @override 12 : Widget build(BuildContext context, IHomeViewModel viewModel) { 13 1 : return Scaffold( 14 1 : appBar: AppBar( 15 1 : title: Text('Example'), 16 : ), 17 1 : body: Center( 18 1 : child: Column( 19 : mainAxisSize: MainAxisSize.min, 20 : mainAxisAlignment: MainAxisAlignment.center, 21 1 : children: <Widget>[ 22 1 : Text('You have pushed the button this many times:'), 23 2 : CountView(key: LabeledGlobalKey("CountView")), 24 : ], 25 : ), 26 : ), 27 1 : floatingActionButton: FloatingActionButton( 28 : key: const Key('increment_floatingActionButton'), 29 2 : onPressed: () => viewModel.increment(), 30 : tooltip: 'Increment', 31 : child: const Icon(Icons.add), 32 : ), 33 : ); 34 : } 35 : }