fix alignment of children of bar
This commit is contained in:
parent
30af165d02
commit
97a7c43a93
3 changed files with 63 additions and 48 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:collection/collection.dart';
|
||||||
import 'package:flight/controllers/time_controller.dart';
|
import 'package:flight/controllers/time_controller.dart';
|
||||||
import 'package:flight/controllers/workspaces_controller.dart';
|
import 'package:flight/controllers/workspaces_controller.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
@ -11,16 +12,14 @@ class Bar extends ConsumerWidget {
|
||||||
Widget build(BuildContext context, WidgetRef ref) => Center(
|
Widget build(BuildContext context, WidgetRef ref) => Center(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||||
child: Row(
|
child: Stack(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children:
|
children:
|
||||||
[
|
[
|
||||||
...ref
|
ref
|
||||||
.watch(WorkspacesController.provider)
|
.watch(WorkspacesController.provider)
|
||||||
.when(
|
.when(
|
||||||
error: (error, stackTrace) => [Text(error.toString())],
|
error: (error, stackTrace) => [Text(error.toString())],
|
||||||
loading: () => [],
|
loading: () => [SizedBox.shrink()],
|
||||||
data: (value) => value
|
data: (value) => value
|
||||||
.map(
|
.map(
|
||||||
(group) => Row(
|
(group) => Row(
|
||||||
|
|
@ -40,11 +39,7 @@ class Bar extends ConsumerWidget {
|
||||||
)
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
),
|
),
|
||||||
Center(
|
[
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
child: Text(
|
child: Text(
|
||||||
|
|
@ -60,24 +55,39 @@ class Bar extends ConsumerWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
|
||||||
),
|
[
|
||||||
Row(
|
Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
children: [
|
||||||
IconButton(onPressed: () {}, icon: Icon(Icons.wifi)),
|
IconButton(onPressed: () {}, icon: Icon(Icons.wifi)),
|
||||||
IconButton(onPressed: () {}, icon: Icon(Icons.bluetooth)),
|
IconButton(
|
||||||
|
onPressed: () {},
|
||||||
|
icon: Icon(Icons.bluetooth),
|
||||||
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
icon: Icon(Icons.volume_off),
|
icon: Icon(Icons.volume_off),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
],
|
||||||
]
|
]
|
||||||
|
.mapIndexed(
|
||||||
|
(index, children) => Align(
|
||||||
|
alignment: [
|
||||||
|
Alignment.centerLeft,
|
||||||
|
Alignment.center,
|
||||||
|
Alignment.centerRight,
|
||||||
|
][index],
|
||||||
|
child: Row(
|
||||||
|
spacing: 8,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: children
|
||||||
.map(
|
.map(
|
||||||
(child) => Padding(
|
(child) => Padding(
|
||||||
padding: EdgeInsetsGeometry.directional(bottom: 6),
|
padding: EdgeInsetsGeometry.directional(
|
||||||
|
bottom: 6,
|
||||||
|
),
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 42,
|
height: 42,
|
||||||
padding: EdgeInsets.symmetric(horizontal: 12),
|
padding: EdgeInsets.symmetric(horizontal: 12),
|
||||||
|
|
@ -94,5 +104,9 @@ class Bar extends ConsumerWidget {
|
||||||
.toList(),
|
.toList(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ packages:
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.11.1"
|
version: "4.11.1"
|
||||||
collection:
|
collection:
|
||||||
dependency: transitive
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: collection
|
name: collection
|
||||||
sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
|
sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ dependencies:
|
||||||
rust_lib_flight:
|
rust_lib_flight:
|
||||||
path: rust_builder
|
path: rust_builder
|
||||||
flutter_rust_bridge: 2.11.1
|
flutter_rust_bridge: 2.11.1
|
||||||
|
collection: ^1.19.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
build_runner: ^2.13.1
|
build_runner: ^2.13.1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue