First commit

This commit is contained in:
aliakbar
2026-06-25 21:21:30 +03:30
parent 55d33677d9
commit 5c34cef2c3
147 changed files with 7197 additions and 0 deletions
+156
View File
@@ -0,0 +1,156 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'screens/devices_screen.dart';
import 'screens/documents_screen.dart';
import 'screens/upload_screen.dart';
import 'screens/chat_screen.dart';
import 'providers/app_state.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ChangeNotifierProvider(
create: (_) => AppState()..loadDevices(),
child: MaterialApp(
title: 'هم هوش',
debugShowCheckedModeBanner: false,
theme: ThemeData(
useMaterial3: true,
fontFamily: 'Vazirmatn', // 👈 Set the Persian font globally
brightness: Brightness.light,
primarySwatch: Colors.teal,
scaffoldBackgroundColor: Colors.transparent,
cardTheme: CardThemeData(
elevation: 4,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)),
clipBehavior: Clip.antiAlias,
color: Colors.white.withOpacity(0.85),
),
appBarTheme: const AppBarTheme(
backgroundColor: Colors.transparent,
elevation: 0,
centerTitle: true,
iconTheme: IconThemeData(color: Colors.teal),
titleTextStyle: TextStyle(color: Colors.teal, fontSize: 22, fontWeight: FontWeight.bold),
),
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
elevation: 2,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(30)),
padding: const EdgeInsets.symmetric(horizontal: 28, vertical: 14),
backgroundColor: const Color(0xFF8BC34A),
foregroundColor: Colors.white,
),
),
inputDecorationTheme: InputDecorationTheme(
filled: true,
fillColor: Colors.white,
border: OutlineInputBorder(borderRadius: BorderRadius.circular(30), borderSide: BorderSide.none),
enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(30), borderSide: BorderSide.none),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(30),
borderSide: const BorderSide(color: Color(0xFF8BC34A), width: 2),
),
),
),
home: MainScreen(),
),
);
}
}
class MainScreen extends StatefulWidget {
@override
State<MainScreen> createState() => _MainScreenState();
}
class _MainScreenState extends State<MainScreen> with SingleTickerProviderStateMixin {
int _selectedIndex = 0;
late AnimationController _animationController;
late Animation<double> _fadeAnimation;
final List<Widget> _pages = [
DevicesScreen(),
DocumentsScreen(),
UploadScreen(),
ChatScreen(),
];
final List<BottomNavigationBarItem> _navItems = [
const BottomNavigationBarItem(icon: Icon(Icons.devices), label: 'دستگاه‌ها'),
const BottomNavigationBarItem(icon: Icon(Icons.folder_open), label: 'اسناد'),
const BottomNavigationBarItem(icon: Icon(Icons.cloud_upload), label: 'بارگذاری'),
const BottomNavigationBarItem(icon: Icon(Icons.chat), label: 'گفتگو'),
];
@override
void initState() {
super.initState();
_animationController = AnimationController(vsync: this, duration: const Duration(milliseconds: 300));
_fadeAnimation = CurvedAnimation(parent: _animationController, curve: Curves.easeInOut);
_animationController.forward();
}
@override
void dispose() {
_animationController.dispose();
super.dispose();
}
void _onTabTapped(int index) {
setState(() {
_selectedIndex = index;
});
_animationController.reset();
_animationController.forward();
}
@override
Widget build(BuildContext context) {
return Scaffold(
extendBody: true,
body: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topRight,
end: Alignment.bottomLeft,
colors: [Color(0xFF1B5E20), Color(0xFF43A047), Color(0xFF0288D1)],
stops: [0.0, 0.4, 1.0],
),
),
child: SafeArea(
child: FadeTransition(
opacity: _fadeAnimation,
child: _pages[_selectedIndex],
),
),
),
bottomNavigationBar: ClipRRect(
borderRadius: const BorderRadius.vertical(top: Radius.circular(30)),
child: Container(
decoration: BoxDecoration(
boxShadow: [BoxShadow(color: Colors.black12, blurRadius: 10, offset: const Offset(0, -3))],
),
child: BottomNavigationBar(
currentIndex: _selectedIndex,
onTap: _onTabTapped,
items: _navItems,
type: BottomNavigationBarType.fixed,
backgroundColor: Colors.white.withOpacity(0.96),
selectedItemColor: const Color(0xFF0288D1),
unselectedItemColor: Colors.grey[500],
showSelectedLabels: true,
showUnselectedLabels: true,
elevation: 0,
selectedLabelStyle: const TextStyle(fontWeight: FontWeight.bold, fontSize: 12),
unselectedLabelStyle: const TextStyle(fontSize: 12),
),
),
),
);
}
}