feat: change base url

This commit is contained in:
Alex
2024-12-18 12:46:19 +03:00
parent e0ec45e19e
commit 12a24e6ead
2 changed files with 56 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
const String baseUrl = 'https://dev2.eatvio.com';
String baseUrl = 'https://dev2.eatvio.com';
const List<int> durationValues = [7, 14, 21];

View File

@@ -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<Dio>().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(