Created
August 25, 2019 08:38
-
-
Save SAGARSURI/07a48fbe1a6e025512365c85ded6bf8c to your computer and use it in GitHub Desktop.
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'; | |
main() { | |
runApp(MaterialApp( | |
home: Scaffold( | |
body: ShapeWidget(), | |
), | |
)); | |
} | |
class ShapeWidget extends StatefulWidget { | |
@override | |
State<StatefulWidget> createState() { | |
// TODO: implement createState | |
return _ShapeWidgetState(); | |
} | |
} | |
class _ShapeWidgetState extends State<ShapeWidget> { | |
var containerOneColor = Colors.blue; | |
@override | |
Widget build(BuildContext context) { | |
return Container( | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.stretch, | |
children: <Widget>[ | |
Row( | |
children: <Widget>[ | |
Expanded( | |
child: GestureDetector( | |
onTap: (){ | |
setState(() { | |
containerOneColor = Colors.yellow; | |
}); | |
}, | |
child: Container( | |
height: 100.0, | |
width: 100.0, | |
color: containerOneColor, | |
), | |
)), | |
Expanded( | |
child: Container( | |
height: 100.0, | |
width: 100.0, | |
color: Colors.tealAccent, | |
)), | |
Expanded( | |
child: Container( | |
height: 100.0, width: 100.0, color: Colors.indigo)) | |
], | |
), | |
Expanded( | |
child: Container( | |
height: 100.0, | |
width: 100.0, | |
color: Colors.black, | |
)), | |
Row( | |
children: <Widget>[ | |
Expanded( | |
child: Container( | |
height: 100.0, | |
width: 100.0, | |
color: Colors.red, | |
)), | |
Expanded( | |
child: Container( | |
height: 100.0, | |
width: 100.0, | |
color: Colors.blue, | |
)), | |
Expanded( | |
child: Container( | |
height: 100.0, | |
width: 100.0, | |
color: Colors.green, | |
)) | |
], | |
), | |
], | |
)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment