commit be6765c7da243f4d1295896b1e50a1498987e8e2
parent 109c9d4d702d9eceeb4b6a6fd72241204d8c6d8f
Author: maydayv7 <maydayv7@gmail.com>
Date: Mon, 1 Dec 2025 18:44:20 +0530
Add `.env` and fix top bar
Diffstat:
5 files changed, 61 insertions(+), 42 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -44,5 +44,6 @@ app.*.map.json
python_env/
# AI Models
+.env
assets/*.onnx*
-/.vscode/
-\ No newline at end of file
+/.vscode/
diff --git a/lib/main.dart b/lib/main.dart
@@ -1,5 +1,6 @@
import 'dart:async';
import 'package:flutter/material.dart';
+import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:receive_sharing_intent/receive_sharing_intent.dart';
import 'package:adobe/services/theme_service.dart';
import 'package:adobe/ui/pages/share_handler_page.dart';
@@ -9,6 +10,7 @@ import 'package:flutter/services.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
+ await dotenv.load(fileName: ".env");
AnalysisQueueManager().processQueue();
runApp(const MyApp());
}
diff --git a/lib/services/flask_service.dart b/lib/services/flask_service.dart
@@ -5,6 +5,7 @@ import 'package:adobe/data/repos/image_repo.dart';
import 'package:adobe/data/repos/note_repo.dart';
import 'package:adobe/data/repos/project_repo.dart';
import 'package:flutter/foundation.dart';
+import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:http/http.dart' as http;
import 'package:path/path.dart' as p;
import 'package:path_provider/path_provider.dart';
@@ -14,8 +15,11 @@ class FlaskService {
// CONFIGURATION
// ===========================================================================
- // NOTE: REPLACE WITH IP ADDRESS OF LOCAL SERVER
- static const String _serverUrl = 'http://10.150.40.117:5000';
+ // Ensure SERVER_URL is defined in .env file
+ static String get _serverUrl {
+ return dotenv.env['SERVER_URL'] ?? 'http://127.0.0.1:5000';
+ }
+
static const Map<String, String> _headers = {
'Content-Type': 'application/json',
};
diff --git a/lib/ui/widgets/top_bar.dart b/lib/ui/widgets/top_bar.dart
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
+import 'package:flutter_svg/flutter_svg.dart';
import 'package:adobe/data/models/project_model.dart';
import 'package:adobe/data/repos/project_repo.dart';
import '../styles/variables.dart';
@@ -96,7 +97,7 @@ class _TopBarState extends State<TopBar> {
child: SizedBox(
height: kToolbarHeight,
child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16),
+ padding: const EdgeInsets.symmetric(horizontal: 4),
child: Row(
children: [
// 1. Back Button
@@ -107,45 +108,50 @@ class _TopBarState extends State<TopBar> {
color: Variables.textPrimary,
),
onPressed: widget.onBack,
- padding: EdgeInsets.zero,
- constraints: const BoxConstraints(),
),
- const SizedBox(width: 12),
+ const SizedBox(width: 8),
],
// 2. Title & Selector
Expanded(
child:
widget.titleOverride != null
- ? Text(
- widget.titleOverride!,
- style: const TextStyle(
- fontSize: 20,
- fontWeight: FontWeight.w600,
- color: Variables.textPrimary,
- ),
- overflow: TextOverflow.ellipsis,
- )
- : (!_isLoading &&
- _currentProject != null &&
- _rootProject != null)
- ? Row(
- children: [
- Flexible(
- child: Text(
- _rootProject!.title,
- style: const TextStyle(
- fontSize: 22,
- fontWeight: FontWeight.w600,
- color: Variables.textPrimary,
- ),
- overflow: TextOverflow.ellipsis,
+ ? Padding(
+ padding: const EdgeInsets.only(left: 8.0),
+ child: Text(
+ widget.titleOverride!,
+ style: const TextStyle(
+ fontFamily: 'GeneralSans',
+ fontSize: 20,
+ fontWeight: FontWeight.w500,
+ color: Variables.textPrimary,
),
+ overflow: TextOverflow.ellipsis,
),
- const SizedBox(width: 8),
- ],
- )
- : const SizedBox(),
+ )
+ : (!_isLoading &&
+ _currentProject != null &&
+ _rootProject != null)
+ ? Row(
+ children: [
+ if (widget.onBack == null)
+ const SizedBox(width: 12),
+ Flexible(
+ child: Text(
+ _rootProject!.title,
+ style: const TextStyle(
+ fontFamily: 'GeneralSans',
+ fontSize: 20,
+ fontWeight: FontWeight.w500,
+ color: Variables.textPrimary,
+ ),
+ overflow: TextOverflow.ellipsis,
+ ),
+ ),
+ const SizedBox(width: 8),
+ ],
+ )
+ : const SizedBox(),
),
if (!_isLoading &&
_currentProject != null &&
@@ -160,7 +166,7 @@ class _TopBarState extends State<TopBar> {
),
offset: const Offset(0, 38),
child: Container(
- padding: EdgeInsets.symmetric(
+ padding: const EdgeInsets.symmetric(
horizontal: 14,
vertical: 10,
),
@@ -176,6 +182,7 @@ class _TopBarState extends State<TopBar> {
? "Main"
: _currentProject!.title,
style: Variables.bodyStyle.copyWith(
+ fontFamily: 'GeneralSans',
fontSize: 15 * textScaler.scale(1.1),
fontWeight: FontWeight.w500,
color: Variables.textPrimary,
@@ -199,6 +206,7 @@ class _TopBarState extends State<TopBar> {
child: Text(
isRoot ? "Main Project" : project.title,
style: Variables.bodyStyle.copyWith(
+ fontFamily: 'GeneralSans',
fontWeight:
isSelected
? FontWeight.bold
@@ -213,17 +221,20 @@ class _TopBarState extends State<TopBar> {
}).toList();
},
),
- const SizedBox(width: 12),
+ const SizedBox(width: 4),
// 3. Settings Icon
IconButton(
- icon: const Icon(
- Icons.settings_outlined,
- color: Variables.textPrimary,
+ icon: SvgPicture.asset(
+ 'assets/icons/settings-line.svg',
+ width: 24,
+ height: 24,
+ colorFilter: const ColorFilter.mode(
+ Variables.textPrimary,
+ BlendMode.srcIn,
+ ),
),
onPressed: widget.onSettingsPressed,
- padding: EdgeInsets.zero,
- constraints: const BoxConstraints(),
),
],
),
diff --git a/pubspec.yaml b/pubspec.yaml
@@ -31,6 +31,7 @@ dependencies:
flutter_box_transform: ^0.4.7
dotted_border: ^2.0.0
share_plus: ^12.0.1
+ flutter_dotenv: ^6.0.0
dev_dependencies:
flutter_test:
@@ -42,6 +43,7 @@ flutter:
uses-material-design: true
assets:
+ - .env
- assets/fonts/
- assets/icons/
- assets/moodboard_blob.png