/
main.dart
66 lines (61 loc) · 1.72 KB
/
main.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import 'package:flutter/material.dart';
import 'package:flutter_responsive_breakpoints/flutter_responsive_breakpoints.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) => Responsive(
builder: (context) => MaterialApp(
title: 'Package demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(),
));
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key? key}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Package demo'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
width: 50,
height: 50,
color: responsive<Color>(
def: Colors.red,
sm: Colors.orange,
md: Colors.yellow,
lg: Colors.green,
xl: Colors.blue,
xxl: Colors.indigo)),
Container(
width: r<double>(def: 10, sm: 15, lg: 50, xl: 100),
height: 50,
color: responsive<Color>(
def: Colors.red,
sm: Colors.orange,
xl: Colors.blue,
)),
Container(
color: Colors.grey,
width: 90.vw,
height: 50,
)
],
),
),
);
}
}