import 'package:flutter/material.dart';
import 'package:netrain_flutter_app/jishuaishuai/MVVMDemo/ViewModelDemo.dart';
import 'package:provider/provider.dart';


class MVVMViewDemo extends StatefulWidget {
  MVVMViewDemo({Key key}) : super(key: key);

  @override
  _MVVMViewDemoState createState() {
    return _MVVMViewDemoState();
  }
}

class _MVVMViewDemoState extends State<MVVMViewDemo> {
  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: Text("MVVM模式"),
      ),
      body: ElevatedButton(
        child: Text("点击调用get请求"),
        onPressed: ()async{
          context.read<ViewModelGet>().get("1");
        },
      ),
    );
  }
}