mirror of
https://github.com/flutter/samples.git
synced 2025-11-09 06:18:49 +00:00
Made elements on component screen stay compact on wider screen (#1258)
This commit is contained in:
@@ -11,6 +11,10 @@ class ComponentScreen extends StatelessWidget {
|
|||||||
return Expanded(
|
return Expanded(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.topCenter,
|
||||||
|
child: SizedBox(
|
||||||
|
width: _maxWidthConstraint,
|
||||||
child: ListView(
|
child: ListView(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
children: [
|
children: [
|
||||||
@@ -33,6 +37,8 @@ class ComponentScreen extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,6 +46,7 @@ class ComponentScreen extends StatelessWidget {
|
|||||||
const _rowDivider = SizedBox(width: 10);
|
const _rowDivider = SizedBox(width: 10);
|
||||||
const _colDivider = SizedBox(height: 10);
|
const _colDivider = SizedBox(height: 10);
|
||||||
const double _cardWidth = 115;
|
const double _cardWidth = 115;
|
||||||
|
const double _maxWidthConstraint = 400;
|
||||||
|
|
||||||
void Function()? handlePressed(
|
void Function()? handlePressed(
|
||||||
BuildContext context, bool isDisabled, String buttonName) {
|
BuildContext context, bool isDisabled, String buttonName) {
|
||||||
@@ -255,8 +262,7 @@ class Cards extends StatelessWidget {
|
|||||||
alignment: Alignment.topRight,
|
alignment: Alignment.topRight,
|
||||||
child: Icon(Icons.more_vert),
|
child: Icon(Icons.more_vert),
|
||||||
),
|
),
|
||||||
_colDivider,
|
SizedBox(height: 35),
|
||||||
_colDivider,
|
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.bottomLeft,
|
alignment: Alignment.bottomLeft,
|
||||||
child: Text("Elevated"),
|
child: Text("Elevated"),
|
||||||
@@ -279,8 +285,7 @@ class Cards extends StatelessWidget {
|
|||||||
alignment: Alignment.topRight,
|
alignment: Alignment.topRight,
|
||||||
child: Icon(Icons.more_vert),
|
child: Icon(Icons.more_vert),
|
||||||
),
|
),
|
||||||
_colDivider,
|
SizedBox(height: 35),
|
||||||
_colDivider,
|
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.bottomLeft,
|
alignment: Alignment.bottomLeft,
|
||||||
child: Text("Filled"),
|
child: Text("Filled"),
|
||||||
@@ -308,8 +313,7 @@ class Cards extends StatelessWidget {
|
|||||||
alignment: Alignment.topRight,
|
alignment: Alignment.topRight,
|
||||||
child: Icon(Icons.more_vert),
|
child: Icon(Icons.more_vert),
|
||||||
),
|
),
|
||||||
_colDivider,
|
SizedBox(height: 35),
|
||||||
_colDivider,
|
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.bottomLeft,
|
alignment: Alignment.bottomLeft,
|
||||||
child: Text("Outlined"),
|
child: Text("Outlined"),
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ class _Material3DemoState extends State<Material3Demo> {
|
|||||||
selectedIndex: screenIndex)),
|
selectedIndex: screenIndex)),
|
||||||
const VerticalDivider(thickness: 1, width: 1),
|
const VerticalDivider(thickness: 1, width: 1),
|
||||||
createScreenFor(screenIndex, true),
|
createScreenFor(screenIndex, true),
|
||||||
]),
|
],),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user