bootstrap_grid 1.0.1
bootstrap_grid: ^1.0.1 copied to clipboard
Bootstrap Grid Implementation
example/lib/main.dart
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:bootstrap_grid/bootstrap_grid.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key? key, this.title}) : super(key: key);
final String? title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title!),
),
body: _buildGridList());
}
Widget _buildGridList() {
return BootstrapList(
rowMainAxisAlignment: MainAxisAlignment.center,
desiredItemWidth: 100,
minSpacing: 10,
children: [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20
].map((i) {
return Container(
height: 100,
alignment: Alignment(0, 0),
color: Colors.cyan,
child: Text(i.toString()),
);
}).toList());
}
// Widget _buildGridLayout() {
// return Column(
// mainAxisAlignment: MainAxisAlignment.start,
// children: <Widget>[
// BootstrapRow(
// children: [
// BootstrapCol(
// lg: 12,
// child: Container(
// height: 100,
// alignment: Alignment(0, 0),
// color: Colors.purple,
// child: Text("lg : 12"),
// ),
// ),
// BootstrapCol(
// xs: 6,
// md: 3,
// child: Container(
// height: 100,
// alignment: Alignment(0, 0),
// color: Colors.green,
// child: Text("xs : 6 \r\nmd : 3"),
// ),
// ),
// BootstrapCol(
// xs: 6,
// md: 3,
// child: Container(
// height: 100,
// alignment: Alignment(0, 0),
// color: Colors.orange,
// child: Text("xs : 6 \r\nmd : 3"),
// ),
// ),
// BootstrapCol(
// xs: 6,
// md: 3,
// child: Container(
// height: 100,
// alignment: Alignment(0, 0),
// color: Colors.red,
// child: Text("xs : 6 \r\nmd : 3"),
// ),
// ),
// BootstrapCol(
// xs: 6,
// md: 3,
// child: Container(
// height: 100,
// alignment: Alignment(0, 0),
// color: Colors.blue,
// child: Text("xs : 6 \r\nmd : 3"),
// ),
// ),
// ],
// ),
// ],
// );
// }
// Widget _buildGridLayout_testCrossAlign() {
// return Column(
// mainAxisAlignment: MainAxisAlignment.start,
// children: <Widget>[
// BootstrapRow(
// children: [
// BootstrapCol(
// xs: 6,
// child: Column(
// children: [
// Container(
// height: 100,
// color: Colors.blue,
// margin: EdgeInsets.all(10),
// ), // height 100px
// Container(
// height: 100,
// color: Colors.blueGrey,
// margin: EdgeInsets.all(10),
// ) // height 100px
// ],
// ),
// ),
// BootstrapCol(
// xs: 6,
// child: Container(
// height: 400,
// color: Colors.black45,
// margin: EdgeInsets.all(10),
// ), // height 500px
// )
// ],
// ),
// ],
// );
// }
}