码迷,mamicode.com
首页 > 其他好文 > 详细

custom drawer

时间:2019-06-14 14:51:57      阅读:95      评论:0      收藏:0      [点我收藏+]

标签:creat   media   class   containe   uil   contain   material   contex   ble   

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(
          width: w, height: h,
          child: Row(
            mainAxisAlignment: MainAxisAlignment.start,
            children: <Widget>[
              Container(color: Colors.black, width: draw,),
              Container(
                width: 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;
          });
        }),
      ),
    );
  }
}

  

custom drawer

标签:creat   media   class   containe   uil   contain   material   contex   ble   

原文地址:https://www.cnblogs.com/pythonClub/p/11022927.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!