-
-
Save vshvedov/5a3ca0a91d9fbc512dc26c96266476e0 to your computer and use it in GitHub Desktop.
Sunflower
This file contains 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
<h2>Btn example</h2> | |
<div> | |
<canvas id="canvas" width="300" height="300"></canvas> | |
</div> | |
This file contains 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(new MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return new MaterialApp( | |
title: 'Flutter Demo', | |
home: new MyHomePage(), | |
); | |
} | |
} | |
class MyHomePage extends StatefulWidget { | |
@override | |
_MyHomePageState createState() => _MyHomePageState(); | |
} | |
class _MyHomePageState extends State<MyHomePage> { | |
var expanded = true; | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Column( | |
children: [ | |
Stack( | |
children: <Widget>[ | |
Row( | |
children: [ | |
Container( | |
color: Colors.green, | |
height: 120, | |
width: MediaQuery.of(context).size.width * 0.50, | |
), //Sub btn1 | |
Container( | |
color: Colors.red, | |
height: 120, | |
width: MediaQuery.of(context).size.width * 0.50, | |
), //Sub btn2 | |
], | |
), | |
GestureDetector( | |
child: AnimatedContainer( | |
duration: const Duration(milliseconds: 200), | |
height: expanded ? 120 : 0, | |
child: Container( | |
height: 120, | |
color: Colors.grey[300], | |
), | |
), | |
onTap: () => setState(() { | |
expanded = !expanded; | |
}) | |
), //Main btn | |
] | |
), | |
], | |
), | |
); | |
} | |
} |
This file contains 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
/* Copyright 2011 the Dart project authors. All rights reserved. */ | |
/* Use of this source code is governed by a BSD-style license */ | |
/* that can be found in the LICENSE file. */ | |
h2 { | |
margin-bottom: 0; | |
text-align: center; | |
} | |
div { | |
text-align: center; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment