wip popovers
This commit is contained in:
parent
91c2d20e9b
commit
6d25568c59
7 changed files with 136 additions and 55 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:collection/collection.dart';
|
||||
import 'package:flight/controllers/time_controller.dart';
|
||||
import 'package:flight/controllers/workspaces_controller.dart';
|
||||
import 'package:flight/widgets/bubble.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
|
@ -21,82 +22,87 @@ class Bar extends ConsumerWidget {
|
|||
loading: () => [SizedBox.shrink()],
|
||||
data: (value) => value
|
||||
.map(
|
||||
(group) => Row(
|
||||
children: group
|
||||
.map(
|
||||
(workspace) => IconButton(
|
||||
onPressed: () => workspace.activate(),
|
||||
icon: Icon(
|
||||
workspace.activated
|
||||
? Icons.circle
|
||||
: Icons.circle_outlined,
|
||||
(group) => Bubble(
|
||||
Row(
|
||||
children: group
|
||||
.map(
|
||||
(workspace) => IconButton(
|
||||
onPressed: () => workspace.activate(),
|
||||
icon: Icon(
|
||||
workspace.activated
|
||||
? Icons.circle
|
||||
: Icons.circle_outlined,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
[
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: Text(
|
||||
DateFormat.Hm().format(
|
||||
ref
|
||||
.watch(TimeController.provider)
|
||||
.when(
|
||||
data: (time) => time,
|
||||
loading: DateTime.now,
|
||||
error: (_, _) => DateTime.now(),
|
||||
Bubble(
|
||||
popover: Bubble(
|
||||
Padding(
|
||||
padding: EdgeInsetsGeometry.all(8),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
DateFormat.MMMMEEEEd().format(DateTime.now()),
|
||||
style: Theme.of(context).textTheme.headlineMedium,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Center(
|
||||
child: Text(
|
||||
DateFormat.Hm().format(
|
||||
ref
|
||||
.watch(TimeController.provider)
|
||||
.when(
|
||||
data: (time) => time,
|
||||
loading: DateTime.now,
|
||||
error: (_, _) => DateTime.now(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
[
|
||||
Row(
|
||||
children: [
|
||||
IconButton(onPressed: () {}, icon: Icon(Icons.wifi)),
|
||||
IconButton(onPressed: () {}, icon: Icon(Icons.bluetooth)),
|
||||
Bubble(
|
||||
Row(
|
||||
children: [
|
||||
IconButton(onPressed: () {}, icon: Icon(Icons.wifi)),
|
||||
IconButton(
|
||||
onPressed: () {},
|
||||
icon: Icon(Icons.bluetooth),
|
||||
),
|
||||
|
||||
IconButton(
|
||||
onPressed: () {},
|
||||
icon: Icon(Icons.volume_off),
|
||||
),
|
||||
],
|
||||
IconButton(
|
||||
onPressed: () {},
|
||||
icon: Icon(Icons.volume_off),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
]
|
||||
.mapIndexed(
|
||||
(index, children) => Align(
|
||||
alignment: [
|
||||
Alignment.centerLeft,
|
||||
Alignment.center,
|
||||
Alignment.centerRight,
|
||||
Alignment.bottomLeft,
|
||||
Alignment.bottomCenter,
|
||||
Alignment.bottomRight,
|
||||
][index],
|
||||
child: Row(
|
||||
spacing: 8,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: children
|
||||
.map(
|
||||
(child) => Padding(
|
||||
padding: EdgeInsetsGeometry.directional(bottom: 6),
|
||||
child: Container(
|
||||
height: 42,
|
||||
padding: EdgeInsets.symmetric(horizontal: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.surfaceContainerLow,
|
||||
borderRadius: BorderRadius.circular(999),
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
children: children,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue