zoukankan      html  css  js  c++  java
  • custom drawer

    import 'package:flutter/material.dart';
    
    main() => runApp(MaterialApp(
      home: HomePage(),
    ));
    
    class HomePage extends StatefulWidget {
      @override
      State<StatefulWidget> createState() {
        return HomePageState();
      }
    }
    
    class HomePageState extends State<HomePage> {
      double w, h;
      double page;
      double draw = 0.0;
      double i = 50;
      bool ini = true;
    
      @override
      Widget build(BuildContext context) {
        w = MediaQuery.of(context).size.width;
        h = MediaQuery.of(context).size.height;
    
        if(ini) {
          page = w;
          ini = !ini;
        }
    
        return SafeArea(
          child: Scaffold(
            body: Container(
               w, height: h,
              child: Row(
                mainAxisAlignment: MainAxisAlignment.start,
                children: <Widget>[
                  Container(color: Colors.black,  draw,),
                  Container(
                     page,
                    child: SingleChildScrollView(
                        scrollDirection: Axis.horizontal,
                        child: Container(color: Colors.amberAccent,child: Text('atest'),)),
                  ),
                ],
              ),
            ),
            floatingActionButton: FloatingActionButton(onPressed: (){
              setState(() {
                draw = w * 3/5;
                page = w * 2/5;
              });
            }),
          ),
        );
      }
    }
    

      

  • 相关阅读:
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    落忆枫音(我们终将成为”枫音乡的过客“)
    PID221 / 烦人的幻灯片☆ x
    codevs 5971 打击犯罪 x
    洛谷 P2330 [SCOI2005] 繁忙的都市 x
  • 原文地址:https://www.cnblogs.com/pythonClub/p/11022927.html
Copyright © 2011-2022 走看看