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/workspaces_controller.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
|
@ -11,16 +12,14 @@ class Bar extends ConsumerWidget {
|
|||
Widget build(BuildContext context, WidgetRef ref) => Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
child: Stack(
|
||||
children:
|
||||
[
|
||||
...ref
|
||||
ref
|
||||
.watch(WorkspacesController.provider)
|
||||
.when(
|
||||
error: (error, stackTrace) => [Text(error.toString())],
|
||||
loading: () => [],
|
||||
loading: () => [SizedBox.shrink()],
|
||||
data: (value) => value
|
||||
.map(
|
||||
(group) => Row(
|
||||
|
|
@ -40,11 +39,7 @@ class Bar extends ConsumerWidget {
|
|||
)
|
||||
.toList(),
|
||||
),
|
||||
Center(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
[
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: Text(
|
||||
|
|
@ -60,24 +55,39 @@ class Bar extends ConsumerWidget {
|
|||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
[
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
IconButton(onPressed: () {}, icon: Icon(Icons.wifi)),
|
||||
IconButton(onPressed: () {}, icon: Icon(Icons.bluetooth)),
|
||||
IconButton(
|
||||
onPressed: () {},
|
||||
icon: Icon(Icons.bluetooth),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {},
|
||||
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(
|
||||
(child) => Padding(
|
||||
padding: EdgeInsetsGeometry.directional(bottom: 6),
|
||||
padding: EdgeInsetsGeometry.directional(
|
||||
bottom: 6,
|
||||
),
|
||||
child: Container(
|
||||
height: 42,
|
||||
padding: EdgeInsets.symmetric(horizontal: 12),
|
||||
|
|
@ -94,5 +104,9 @@ class Bar extends ConsumerWidget {
|
|||
.toList(),
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ packages:
|
|||
source: hosted
|
||||
version: "4.11.1"
|
||||
collection:
|
||||
dependency: transitive
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: collection
|
||||
sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ dependencies:
|
|||
rust_lib_flight:
|
||||
path: rust_builder
|
||||
flutter_rust_bridge: 2.11.1
|
||||
collection: ^1.19.1
|
||||
|
||||
dev_dependencies:
|
||||
build_runner: ^2.13.1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue