Skip to content

Instantly share code, notes, and snippets.

@SAGARSURI
Created August 25, 2019 08:38
Show Gist options
  • Save SAGARSURI/07a48fbe1a6e025512365c85ded6bf8c to your computer and use it in GitHub Desktop.
Save SAGARSURI/07a48fbe1a6e025512365c85ded6bf8c to your computer and use it in GitHub Desktop.
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