From 09962fafddddfd5176229ffd6a910d00c3c310c6 Mon Sep 17 00:00:00 2001 From: kumarpalsinh25 Date: Thu, 15 Aug 2024 20:04:26 +0530 Subject: [PATCH] Delete edit pin link bottom sheet --- app/lib/common/widgets/edit_link_sheet.dart | 106 -------------------- 1 file changed, 106 deletions(-) delete mode 100644 app/lib/common/widgets/edit_link_sheet.dart diff --git a/app/lib/common/widgets/edit_link_sheet.dart b/app/lib/common/widgets/edit_link_sheet.dart deleted file mode 100644 index 3ba4de981fcc..000000000000 --- a/app/lib/common/widgets/edit_link_sheet.dart +++ /dev/null @@ -1,106 +0,0 @@ -import 'package:acter/common/toolkit/buttons/primary_action_button.dart'; -import 'package:atlas_icons/atlas_icons.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:flutter_gen/gen_l10n/l10n.dart'; - -void showEditLinkBottomSheet({ - required BuildContext context, - String? bottomSheetTitle, - required String linkValue, - required Function(String) onSave, -}) { - showModalBottomSheet( - showDragHandle: true, - useSafeArea: true, - context: context, - constraints: const BoxConstraints(maxHeight: 300), - builder: (context) { - return EditLinkSheet( - bottomSheetTitle: bottomSheetTitle, - linkValue: linkValue, - onSave: onSave, - ); - }, - ); -} - -class EditLinkSheet extends ConsumerStatefulWidget { - final String? bottomSheetTitle; - final String linkValue; - final Function(String) onSave; - - const EditLinkSheet({ - super.key, - this.bottomSheetTitle, - required this.linkValue, - required this.onSave, - }); - - @override - ConsumerState createState() => _EditTitleSheetState(); -} - -class _EditTitleSheetState extends ConsumerState { - final _linkController = TextEditingController(); - - @override - void initState() { - super.initState(); - _linkController.text = widget.linkValue; - } - - @override - Widget build(BuildContext context) { - return Container( - padding: const EdgeInsets.symmetric(horizontal: 20.0), - constraints: const BoxConstraints(maxWidth: 500), - child: Column( - children: [ - Text( - widget.bottomSheetTitle ?? L10n.of(context).editLink, - textAlign: TextAlign.center, - style: Theme.of(context).textTheme.titleMedium, - ), - const SizedBox(height: 40), - TextFormField( - keyboardType: TextInputType.text, - textInputAction: TextInputAction.done, - controller: _linkController, - autofocus: true, - minLines: 1, - maxLines: 1, - decoration: InputDecoration( - prefixIcon: const Icon(Atlas.link_chain_thin, size: 18), - hintText: L10n.of(context).link, - ), - ), - const SizedBox(height: 20), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - OutlinedButton( - onPressed: () => Navigator.pop(context), - child: Text(L10n.of(context).cancel), - ), - const SizedBox(width: 20), - ActerPrimaryActionButton( - onPressed: () { - // no changes to submit - if (_linkController.text.trim() == widget.linkValue.trim()) { - Navigator.pop(context); - return; - } - - // Need to update change of tile - widget.onSave(_linkController.text.trim()); - }, - child: Text(L10n.of(context).save), - ), - ], - ), - ], - ), - ); - } -}