Compare commits

..

2 Commits

Author SHA1 Message Date
b9aa466a05 Merge pull request 'Ui changes' (#1) from main into dev
Reviewed-on: #1
2025-11-19 20:15:31 +00:00
e757bc2d5a Ui changes 2025-11-20 01:31:47 +05:30
5 changed files with 239 additions and 27 deletions

View File

@ -20,7 +20,7 @@ class SideMenu extends ConsumerWidget {
return Drawer( return Drawer(
child: Column( child: Column(
children: [ children: [
// 🔹 Header // Header
DrawerHeader( DrawerHeader(
decoration: BoxDecoration(color: Color(0xFF3B81F9)), decoration: BoxDecoration(color: Color(0xFF3B81F9)),
child: SizedBox( child: SizedBox(
@ -76,7 +76,7 @@ class SideMenu extends ConsumerWidget {
), ),
), ),
// 🔹 Logout button at the bottom // Logout button at the bottom
const Divider(height: 1), const Divider(height: 1),
Padding( Padding(
padding: const EdgeInsets.only(bottom: 24.0), padding: const EdgeInsets.only(bottom: 24.0),
@ -109,24 +109,28 @@ class SideMenu extends ConsumerWidget {
); );
} }
// 🔸 Section title widget // Section title widget
Widget _sectionHeader(String title) { Widget _sectionHeader(String title) {
return Padding( return Container(
padding: const EdgeInsets.only(left: 8.0), padding: EdgeInsets.symmetric(vertical: 8),
child: Text( decoration: BoxDecoration(color: Color.fromARGB(255, 225, 236, 255)),
title, child: Padding(
style: const TextStyle( padding: const EdgeInsets.only(left: 8.0),
fontFamily: 'Roboto', child: Text(
fontWeight: FontWeight.w700, title,
fontSize: 15, style: const TextStyle(
letterSpacing: 0.5, fontFamily: 'Roboto',
color: Color(0xFF3B81F9), fontWeight: FontWeight.w700,
fontSize: 15,
letterSpacing: 0.5,
color: Color(0xFF3B81F9),
),
), ),
), ),
); );
} }
// 🔸 Menu item widget // Menu item widget
Widget _menuItem( Widget _menuItem(
BuildContext context, BuildContext context,
String emoji, String emoji,
@ -140,7 +144,6 @@ class SideMenu extends ConsumerWidget {
child: InkWell( child: InkWell(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
onTap: () { onTap: () {
Navigator.pop(context);
onItemSelected(route); onItemSelected(route);
Navigator.pushNamed(context, route); Navigator.pushNamed(context, route);
}, },

View File

@ -1,5 +1,4 @@
import 'package:autos/core/routing/app_router.dart'; import 'package:autos/core/routing/app_router.dart';
import 'package:autos/core/routing/route_paths.dart';
import 'package:autos/presentation/providers/user_provider.dart'; import 'package:autos/presentation/providers/user_provider.dart';
import 'package:autos/presentation/screens/auth/login_screen.dart'; import 'package:autos/presentation/screens/auth/login_screen.dart';
import 'package:autos/presentation/screens/dashboard/dashboard_screen.dart'; import 'package:autos/presentation/screens/dashboard/dashboard_screen.dart';
@ -32,21 +31,25 @@ class _MyAppState extends ConsumerState<MyApp> {
// Load user from secure storage // Load user from secure storage
await userNotifier.loadUserFromStorage(); await userNotifier.loadUserFromStorage();
// Stop loading after user is restored
setState(() => _isLoading = false); setState(() => _isLoading = false);
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// Show loading screen until user session is restored
if (_isLoading) {
return const MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(child: CircularProgressIndicator()),
),
);
}
final userState = ref.watch(userProvider); final userState = ref.watch(userProvider);
final user = userState.value; final user = userState.value;
// if (_isLoading) {
// return const MaterialApp(
// debugShowCheckedModeBanner: false,
// home: Scaffold(body: Center(child: CircularProgressIndicator())),
// );
// }
return MaterialApp( return MaterialApp(
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
title: "Autos", title: "Autos",
@ -54,8 +57,8 @@ class _MyAppState extends ConsumerState<MyApp> {
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
), ),
/// Dynamic home based on session // Dynamic home based on session
home: user != null ? DashboardScreen() : LoginScreen(), home: user != null ? const DashboardScreen() : const LoginScreen(),
onGenerateRoute: AppRouter.generateRoute, onGenerateRoute: AppRouter.generateRoute,
); );

View File

@ -32,7 +32,7 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
), ),
body: Stack( body: Stack(
children: [ children: [
// 🔵 TOP BAR RESPONSIVE & CENTERED // TOP BAR RESPONSIVE & CENTERED
Positioned( Positioned(
top: topPadding, top: topPadding,
left: 0, left: 0,

View File

@ -0,0 +1,14 @@
import 'package:flutter/material.dart';
class SplashScreen extends StatelessWidget {
const SplashScreen({super.key});
@override
Widget build(BuildContext context) {
return const Scaffold(
body: Center(
child: CircularProgressIndicator(),
),
);
}
}

View File

@ -1,3 +1,5 @@
import 'package:autos/core/theme/app_typography.dart';
import 'package:autos/core/widgets/hamburger_button.dart';
import 'package:autos/core/widgets/side_menu.dart'; import 'package:autos/core/widgets/side_menu.dart';
import 'package:autos/presentation/providers/user_provider.dart'; import 'package:autos/presentation/providers/user_provider.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -12,7 +14,7 @@ class Turn14Screen extends ConsumerStatefulWidget {
class _Turn14ScreenState extends ConsumerState<Turn14Screen> { class _Turn14ScreenState extends ConsumerState<Turn14Screen> {
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>(); final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
String selected = 'dashboard'; String selected = 'turn14';
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -27,6 +29,196 @@ class _Turn14ScreenState extends ConsumerState<Turn14Screen> {
setState(() => selected = key); setState(() => selected = key);
}, },
), ),
body: Stack(
children: [
Positioned(
top: topPadding,
left: 0,
right: 0,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Turn14 Settings",
style: AppTypo.h2.copyWith(fontWeight: FontWeight.w700),
),
],
),
),
SingleChildScrollView(
padding: EdgeInsets.fromLTRB(16, topPadding + 55, 16, 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Description Row
Row(
children: [
Text("", style: const TextStyle(fontSize: 28)),
const SizedBox(width: 8),
Expanded(
child: Text(
"Manage your Turn14 API credentials securely.",
style: AppTypo.body.copyWith(
color: Colors.black54,
height: 1.4,
),
),
),
],
),
const SizedBox(height: 20),
// Client ID Input
_inputField(
label: "Client ID",
controller: TextEditingController(),
),
const SizedBox(height: 20),
// Secret Key Input With Eye Icon
_passwordField(
label: "Secret Key",
controller: TextEditingController(),
),
const SizedBox(height: 25),
// Save Button
SizedBox(
width: double.infinity,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
backgroundColor: const Color(0xFF00C9FF),
),
onPressed: () {},
child: const Text(
"Save Credentials",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 16,
),
),
),
),
const SizedBox(height: 20),
// Info Box
Container(
width: double.infinity,
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: const Color(0xFFE8F1FF),
borderRadius: BorderRadius.circular(10),
),
child: Row(
children: const [
Icon(Icons.info, color: Colors.blue),
SizedBox(width: 10),
Text(
"No credentials saved yet.",
style: TextStyle(color: Colors.black87),
),
],
),
),
const SizedBox(height: 20),
// Tips Box
Container(
width: double.infinity,
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: const Color(0xFFE8FCFF),
borderRadius: BorderRadius.circular(10),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
Text(
"💡 Connection Tips",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
),
),
SizedBox(height: 10),
Text("• Ensure your credentials are valid and active."),
Text("• Credentials are encrypted before saving."),
Text("• Contact Turn14 support for API setup help."),
],
),
),
],
),
),
HamburgerButton(scaffoldKey: _scaffoldKey),
],
),
); );
} }
Widget _inputField({required String label, required TextEditingController controller}) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(label, style: const TextStyle(fontWeight: FontWeight.w600)),
const SizedBox(height: 8),
TextField(
controller: controller,
decoration: InputDecoration(
filled: true,
fillColor: const Color(0xFFF0F6FF),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide.none,
),
),
),
],
);
}
Widget _passwordField({
required String label,
required TextEditingController controller,
}) {
bool _obscure = true;
return StatefulBuilder(
builder: (context, setStateSB) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(label, style: const TextStyle(fontWeight: FontWeight.w600)),
const SizedBox(height: 8),
TextField(
controller: controller,
obscureText: _obscure,
decoration: InputDecoration(
filled: true,
fillColor: const Color(0xFFF0F6FF),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide.none,
),
suffixIcon: IconButton(
icon: Icon(
_obscure ? Icons.visibility_off : Icons.visibility,
),
onPressed: () => setStateSB(() => _obscure = !_obscure),
),
),
),
],
);
},
);
}
} }