Skip to content

Instantly share code, notes, and snippets.

@vshvedov
Forked from jcollins-g/index.html
Created April 14, 2020 21:19
Show Gist options
  • Save vshvedov/5a3ca0a91d9fbc512dc26c96266476e0 to your computer and use it in GitHub Desktop.
Save vshvedov/5a3ca0a91d9fbc512dc26c96266476e0 to your computer and use it in GitHub Desktop.
Sunflower
<h2>Btn example</h2>
<div>
<canvas id="canvas" width="300" height="300"></canvas>
</div>
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
]
),
],
),
);
}
}
/* 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