美文网首页
Flutter 常用Live Templates分享

Flutter 常用Live Templates分享

作者: JamieChen | 来源:发表于2021-03-29 12:30 被阅读0次

    GetX相关

    1.快速创建GetX页面(包含Page | Controller | Binding)

    import 'package:flutter/material.dart';
    import 'package:get/get.dart';
    
    class $NAME$Page
        extends $NAME$GetView<$NAME$Controller> {
      @override
      Widget build(BuildContext context) {
        return Scaffold();
      }
    }
    
    class $NAME$Controller extends GetxController {
      //Example
      // var num = 0.obs;
      // void increment() => num++;
      // void decrement() => num--;
    }
    
    class $NAME$Binding extends Bindings {
      @override
      void dependencies() {
        // TODO: implement dependencies
        Get.lazyPut<$NAME$Controller>(
            () => $NAME$Controller());
      }
    }
    

    相关文章

      网友评论

          本文标题:Flutter 常用Live Templates分享

          本文链接:https://www.haomeiwen.com/subject/fsqbhltx.html