2022-07-07 11:40:54 -07:00
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
2022-02-09 11:41:02 -07:00
|
|
|
import 'package:flutter/material.dart';
|
2022-08-08 08:46:12 -07:00
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
2022-02-09 11:41:02 -07:00
|
|
|
import 'package:immich_mobile/modules/home/ui/delete_diaglog.dart';
|
|
|
|
|
2022-08-08 08:46:12 -07:00
|
|
|
class ControlBottomAppBar extends ConsumerWidget {
|
2022-10-06 13:41:56 -07:00
|
|
|
final Function onShare;
|
|
|
|
final Function onDelete;
|
|
|
|
|
|
|
|
const ControlBottomAppBar(
|
|
|
|
{Key? key, required this.onShare, required this.onDelete})
|
|
|
|
: super(key: key);
|
2022-02-09 11:41:02 -07:00
|
|
|
|
|
|
|
@override
|
2022-08-08 08:46:12 -07:00
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
2022-02-09 11:41:02 -07: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 13:12:47 -07:00
|
|
|
borderRadius: const BorderRadius.only(
|
2022-08-15 16:53:30 -07:00
|
|
|
topLeft: Radius.circular(8),
|
|
|
|
topRight: Radius.circular(8),
|
2022-07-13 05:23:48 -07:00
|
|
|
),
|
2022-08-15 16:53:30 -07:00
|
|
|
color: Theme.of(context).scaffoldBackgroundColor.withOpacity(0.95),
|
2022-02-09 11:41:02 -07:00
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 20),
|
|
|
|
child: Row(
|
2022-08-08 08:46:12 -07:00
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
2022-02-09 11:41:02 -07:00
|
|
|
children: [
|
|
|
|
ControlBoxButton(
|
|
|
|
iconData: Icons.delete_forever_rounded,
|
2022-07-07 11:40:54 -07:00
|
|
|
label: "control_bottom_app_bar_delete".tr(),
|
2022-02-09 11:41:02 -07:00
|
|
|
onPressed: () {
|
|
|
|
showDialog(
|
|
|
|
context: context,
|
|
|
|
builder: (BuildContext context) {
|
2022-10-06 13:41:56 -07:00
|
|
|
return DeleteDialog(
|
|
|
|
onDelete: onDelete,
|
|
|
|
);
|
2022-02-09 11:41:02 -07:00
|
|
|
},
|
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
2022-08-08 08:46:12 -07:00
|
|
|
ControlBoxButton(
|
|
|
|
iconData: Icons.share,
|
|
|
|
label: "control_bottom_app_bar_share".tr(),
|
|
|
|
onPressed: () {
|
2022-10-06 13:41:56 -07:00
|
|
|
onShare();
|
2022-08-08 08:46:12 -07:00
|
|
|
},
|
|
|
|
),
|
2022-02-09 11:41:02 -07:00
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class ControlBoxButton extends StatelessWidget {
|
2022-07-13 05:23:48 -07:00
|
|
|
const ControlBoxButton({
|
|
|
|
Key? key,
|
|
|
|
required this.label,
|
|
|
|
required this.iconData,
|
|
|
|
required this.onPressed,
|
|
|
|
}) : super(key: key);
|
2022-02-09 11:41:02 -07: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 08:46:12 -07:00
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
2022-02-09 11:41:02 -07:00
|
|
|
children: [
|
|
|
|
IconButton(
|
|
|
|
onPressed: () {
|
|
|
|
onPressed();
|
|
|
|
},
|
|
|
|
icon: Icon(iconData, size: 30),
|
|
|
|
),
|
|
|
|
Text(label)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|