2022-07-07 20:40:54 +02:00
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
2022-02-09 20:41:02 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2022-08-08 17:46:12 +02:00
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
2022-08-16 01:53:30 +02:00
|
|
|
import 'package:immich_mobile/modules/home/providers/home_page_state.provider.dart';
|
2022-02-09 20:41:02 +02:00
|
|
|
import 'package:immich_mobile/modules/home/ui/delete_diaglog.dart';
|
|
|
|
|
2022-08-08 17:46:12 +02:00
|
|
|
class ControlBottomAppBar extends ConsumerWidget {
|
2022-02-09 20:41:02 +02:00
|
|
|
const ControlBottomAppBar({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
2022-08-08 17:46:12 +02:00
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
2022-02-09 20:41:02 +02:00
|
|
|
return Positioned(
|
|
|
|
bottom: 0,
|
|
|
|
left: 0,
|
|
|
|
child: Container(
|
|
|
|
width: MediaQuery.of(context).size.width,
|
|
|
|
height: MediaQuery.of(context).size.height * 0.15,
|
|
|
|
decoration: BoxDecoration(
|
2022-06-25 22:12:47 +02:00
|
|
|
borderRadius: const BorderRadius.only(
|
2022-08-16 01:53:30 +02:00
|
|
|
topLeft: Radius.circular(8),
|
|
|
|
topRight: Radius.circular(8),
|
2022-07-13 14:23:48 +02:00
|
|
|
),
|
2022-08-16 01:53:30 +02:00
|
|
|
color: Theme.of(context).scaffoldBackgroundColor.withOpacity(0.95),
|
2022-02-09 20:41:02 +02:00
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 20),
|
|
|
|
child: Row(
|
2022-08-08 17:46:12 +02:00
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
2022-02-09 20:41:02 +02:00
|
|
|
children: [
|
|
|
|
ControlBoxButton(
|
|
|
|
iconData: Icons.delete_forever_rounded,
|
2022-07-07 20:40:54 +02:00
|
|
|
label: "control_bottom_app_bar_delete".tr(),
|
2022-02-09 20:41:02 +02:00
|
|
|
onPressed: () {
|
|
|
|
showDialog(
|
|
|
|
context: context,
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
return const DeleteDialog();
|
|
|
|
},
|
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
2022-08-08 17:46:12 +02:00
|
|
|
ControlBoxButton(
|
|
|
|
iconData: Icons.share,
|
|
|
|
label: "control_bottom_app_bar_share".tr(),
|
|
|
|
onPressed: () {
|
|
|
|
final homePageState = ref.watch(homePageStateProvider);
|
|
|
|
ref.watch(homePageStateProvider.notifier).shareAssets(
|
|
|
|
homePageState.selectedItems.toList(),
|
|
|
|
context,
|
|
|
|
);
|
|
|
|
ref
|
|
|
|
.watch(homePageStateProvider.notifier)
|
|
|
|
.disableMultiSelect();
|
|
|
|
},
|
|
|
|
),
|
2022-02-09 20:41:02 +02:00
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class ControlBoxButton extends StatelessWidget {
|
2022-07-13 14:23:48 +02:00
|
|
|
const ControlBoxButton({
|
|
|
|
Key? key,
|
|
|
|
required this.label,
|
|
|
|
required this.iconData,
|
|
|
|
required this.onPressed,
|
|
|
|
}) : super(key: key);
|
2022-02-09 20:41:02 +02:00
|
|
|
|
|
|
|
final String label;
|
|
|
|
final IconData iconData;
|
|
|
|
final Function onPressed;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return SizedBox(
|
|
|
|
width: 60,
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
2022-08-08 17:46:12 +02:00
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
2022-02-09 20:41:02 +02:00
|
|
|
children: [
|
|
|
|
IconButton(
|
|
|
|
onPressed: () {
|
|
|
|
onPressed();
|
|
|
|
},
|
|
|
|
icon: Icon(iconData, size: 30),
|
|
|
|
),
|
|
|
|
Text(label)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|