diff --git a/lib/core/const.dart b/lib/core/const.dart index f7dba8dd..7ec91b46 100644 --- a/lib/core/const.dart +++ b/lib/core/const.dart @@ -1,4 +1,4 @@ -const String baseUrl = 'https://dev2.eatvio.com'; +String baseUrl = 'https://dev2.eatvio.com'; const List durationValues = [7, 14, 21]; diff --git a/lib/features/menu/presentation/pages/menu_screen.dart b/lib/features/menu/presentation/pages/menu_screen.dart index 58f0fea3..c1dbcbb5 100644 --- a/lib/features/menu/presentation/pages/menu_screen.dart +++ b/lib/features/menu/presentation/pages/menu_screen.dart @@ -4,12 +4,15 @@ import 'package:eatvio_app/core/token_storage.dart'; import 'package:eatvio_app/core/utils/image_constant.dart'; import 'package:eatvio_app/core/locator_service.dart'; import 'package:eatvio_app/core/theme/theme_helper.dart'; +import 'package:eatvio_app/core/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:go_router/go_router.dart'; class MenuScreen extends StatelessWidget { - const MenuScreen({super.key}); + MenuScreen({super.key}); + + final baseUrlController = TextEditingController(); @override Widget build(BuildContext context) { @@ -17,6 +20,57 @@ class MenuScreen extends StatelessWidget { appBar: AppBar( centerTitle: false, title: Text('Меню'), + actions: [ + SizedBox( + width: MediaQuery.of(context).size.width * 0.7, + child: GestureDetector( + onLongPress: () { + showDialog( + context: context, + builder: (context) => AlertDialog( + title: Text('Base url без https:// и /api'), + content: Column( + mainAxisSize: MainAxisSize.min, + children: [ + CustomTextFormField( + controller: baseUrlController, + hintText: 'dev2.eatvio.com', + ), + const SizedBox(height: 12), + InkWell( + onTap: () async { + await TokenStorage.removeTokenInStorage(); + GoRouter.of(context).go('/auth-screen'); + baseUrl = 'https://${baseUrlController.text}'; + sl().options.baseUrl = baseUrl; + }, + borderRadius: BorderRadius.circular(20), + child: Ink( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20), + color: appTheme.blueA400, + ), + child: Container( + padding: EdgeInsets.symmetric(horizontal: 16, vertical: 12), + alignment: Alignment.center, + child: Text( + 'Сохранить', + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.w600, + ), + ), + ), + ), + ), + ], + ), + ), + ); + }, + ), + ), + ], ), body: SingleChildScrollView( child: Column(