1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-08 12:56:48 +01:00

feat(mobile): Dropdown menu for saved serverendpoint

This commit is contained in:
Alex 2024-04-11 16:55:50 +02:00
parent 37eea2d353
commit c17eeb6b44
No known key found for this signature in database
GPG key ID: 53CD082B3A5E1082

View file

@ -449,24 +449,83 @@ class ServerEndpointInput extends StatelessWidget {
return null; return null;
} }
// @override
// Widget build(BuildContext context) {
// return TextFormField(
// controller: controller,
// decoration: InputDecoration(
// labelText: 'login_form_endpoint_url'.tr(),
// border: const OutlineInputBorder(),
// hintText: 'login_form_endpoint_hint'.tr(),
// errorMaxLines: 4,
// ),
// validator: _validateInput,
// autovalidateMode: AutovalidateMode.always,
// focusNode: focusNode,
// autofillHints: const [AutofillHints.url],
// keyboardType: TextInputType.url,
// autocorrect: false,
// onFieldSubmitted: (_) => onSubmit?.call(),
// textInputAction: TextInputAction.go,
// );
// }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return TextFormField( return LayoutBuilder(
controller: controller, builder: (context, contraints) {
decoration: InputDecoration( return DropdownMenu(
labelText: 'login_form_endpoint_url'.tr(), dropdownMenuEntries: [
border: const OutlineInputBorder(), DropdownMenuEntry<String>(
hintText: 'login_form_endpoint_hint'.tr(), label: "http://10.1.15.104:2283/api",
errorMaxLines: 4, value: "http://10.1.15.104:2283/api",
trailingIcon: IconButton(
onPressed: () {},
icon: const Icon(
Icons.close_rounded,
size: 18,
), ),
validator: _validateInput, ),
autovalidateMode: AutovalidateMode.always, ),
focusNode: focusNode, const DropdownMenuEntry<String>(
autofillHints: const [AutofillHints.url], label: "http://10.1.15.216:2283/api",
keyboardType: TextInputType.url, value: "http://10.1.15.216:2283/api",
autocorrect: false, ),
onFieldSubmitted: (_) => onSubmit?.call(), const DropdownMenuEntry<String>(
textInputAction: TextInputAction.go, label: "https://demo.immich.app",
value: "https://demo.immich.app",
),
],
menuHeight: 150,
width: contraints.maxWidth,
controller: controller,
requestFocusOnTap: true,
enableFilter: true,
enableSearch: true,
hintText: 'login_form_endpoint_hint'.tr(),
label: Text("login_form_endpoint_url".tr()),
inputDecorationTheme: InputDecorationTheme(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(20),
),
contentPadding: const EdgeInsets.only(left: 16),
activeIndicatorBorder: BorderSide(
color: context.primaryColor,
width: 2,
),
),
menuStyle: MenuStyle(
shape: MaterialStatePropertyAll<OutlinedBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
),
backgroundColor: MaterialStatePropertyAll<Color>(
context.isDarkTheme ? Colors.black : Colors.white,
),
),
);
},
); );
} }
} }