Created
April 25, 2019 11:16
-
-
Save agreensh/43f7f3fffb872d9925e662f30636fb38 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| void main() => runApp(MyApp()); | |
| class MyApp extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| title: 'Dvergar Demo', | |
| theme: ThemeData( | |
| primarySwatch: Colors.blue, | |
| ), | |
| home: MyHomePage(title: 'Dvergar Demo Page'), | |
| ); | |
| } | |
| } | |
| class MyHomePage extends StatefulWidget { | |
| MyHomePage({Key key, this.title}) : super(key: key); | |
| final String title; | |
| final GlobalKey keyRed = GlobalKey(); | |
| @override | |
| _MyHomePageState createState() => _MyHomePageState(); | |
| } | |
| class _MyHomePageState extends State<MyHomePage> { | |
| double _redBoxHeight = 0.0; | |
| @override | |
| void initState() { | |
| WidgetsBinding.instance.addPostFrameCallback(_getRedContainerHeight); | |
| super.initState(); | |
| } | |
| _getRedContainerHeight(_) { | |
| final RenderBox renderBoxRed = widget.keyRed.currentContext.findRenderObject(); | |
| final sizeRed = renderBoxRed.size; | |
| setState(() { | |
| _redBoxHeight = sizeRed.height; | |
| }); | |
| print("height = $_redBoxHeight"); | |
| } | |
| @override | |
| Widget build(BuildContext context) { | |
| return Scaffold( | |
| appBar: AppBar( | |
| title: Text(widget.title), | |
| ), | |
| body: Column( | |
| children: <Widget>[ | |
| Card( | |
| elevation: 8.0, | |
| color: Colors.grey, | |
| child: Center( | |
| child: Container( | |
| height: 200.0, | |
| child: Center( | |
| child: Text("This is where the video player shows\n Replace with 'Chewie' widget."), | |
| ), | |
| ), | |
| ), | |
| ), | |
| Expanded( | |
| child: ListView( | |
| shrinkWrap: true, | |
| padding: const EdgeInsets.all(20.0), | |
| children: [ | |
| Row( | |
| children: <Widget>[ | |
| Expanded( | |
| child: Container( | |
| key: widget.keyRed, | |
| padding: EdgeInsets.only(left: 12.0, right: 12.0), | |
| color: Colors.red, | |
| child: Column( | |
| children: <Widget>[ | |
| Text("one"), | |
| Text("two"), | |
| Text("three"), | |
| Text("four"), | |
| ], | |
| ), | |
| ), | |
| ), | |
| Container( | |
| padding: EdgeInsets.only(left: 12.0, right: 12.0), | |
| height: _redBoxHeight, | |
| //width: 100.0, | |
| color: Colors.yellow, | |
| child: Column( | |
| mainAxisAlignment: MainAxisAlignment.spaceEvenly, | |
| children: <Widget>[ | |
| Text("bye 1"), | |
| Text("bye 2"), | |
| ], | |
| ), | |
| ), | |
| ], | |
| ), | |
| SizedBox( | |
| height: 32.0, | |
| ), | |
| Center( | |
| child: SizedBox( | |
| width: 150.0, | |
| child: FlatButton( | |
| color: Colors.blueAccent, | |
| onPressed: () { | |
| }, | |
| child: Text('Add move'), | |
| ), | |
| ), | |
| ), | |
| ], | |
| ), | |
| ), | |
| ] | |
| ) | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment