This commit introduces the initial setup for the Lightcloud Flutter application including: - Basic project structure with Android and web configurations - Authentication screen with login/register functionality - Initial UI components and theme setup
172 lines
6 KiB
Dart
172 lines
6 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
void main() {
|
|
runApp(const MyApp());
|
|
}
|
|
|
|
class MyApp extends StatelessWidget {
|
|
const MyApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
title: 'Litecloud alpha',
|
|
theme: ThemeData(
|
|
colorScheme:
|
|
ColorScheme.fromSeed(seedColor: Color.fromARGB(255, 72, 4, 117)),
|
|
useMaterial3: true,
|
|
),
|
|
home: const AuthScreen(),
|
|
);
|
|
}
|
|
}
|
|
|
|
class AuthScreen extends StatefulWidget {
|
|
const AuthScreen({super.key});
|
|
|
|
@override
|
|
State<AuthScreen> createState() => _AuthScreenState();
|
|
}
|
|
|
|
class _AuthScreenState extends State<AuthScreen> {
|
|
bool _isLogin = true;
|
|
|
|
void _toggleAuthMode() {
|
|
setState(() {
|
|
_isLogin = !_isLogin;
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final deviceSize = MediaQuery.of(context).size;
|
|
|
|
return Scaffold(
|
|
body: Container(
|
|
width: deviceSize.width,
|
|
height: deviceSize.height,
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
colors: [Colors.purple, Color.fromARGB(255, 72, 4, 117)],
|
|
begin: Alignment.topLeft,
|
|
end: Alignment.bottomRight,
|
|
),
|
|
),
|
|
child: SafeArea(
|
|
child: SingleChildScrollView(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16.0),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
const SizedBox(height: 60),
|
|
// Logo and tagline
|
|
Container(
|
|
margin: const EdgeInsets.only(bottom: 40.0),
|
|
child: Column(
|
|
children: [
|
|
Text(
|
|
'Litecloud',
|
|
style: TextStyle(
|
|
fontSize: 42,
|
|
fontWeight: FontWeight.bold,
|
|
color: Theme.of(context).colorScheme.onPrimary,
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
'Rust based cloud storage',
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
color: Theme.of(context).colorScheme.onPrimary,
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
'Version 0.0.1 pre-alpha',
|
|
style: TextStyle(
|
|
fontSize: 8,
|
|
color: Theme.of(context).colorScheme.onPrimary,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
// Auth card
|
|
Card(
|
|
margin: const EdgeInsets.symmetric(horizontal: 600.0),
|
|
elevation: 8.0,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(16.0),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16.0),
|
|
child: Column(
|
|
children: [
|
|
Text(
|
|
_isLogin ? 'Login' : 'Register',
|
|
style: Theme.of(context).textTheme.headlineMedium,
|
|
),
|
|
const SizedBox(height: 40),
|
|
TextFormField(
|
|
decoration: const InputDecoration(
|
|
labelText: 'Email',
|
|
prefixIcon: Icon(Icons.email),
|
|
border: OutlineInputBorder(),
|
|
),
|
|
keyboardType: TextInputType.emailAddress,
|
|
),
|
|
const SizedBox(height: 16),
|
|
TextFormField(
|
|
decoration: const InputDecoration(
|
|
labelText: 'Password',
|
|
prefixIcon: Icon(Icons.lock),
|
|
border: OutlineInputBorder(),
|
|
),
|
|
obscureText: true,
|
|
),
|
|
if (!_isLogin) const SizedBox(height: 16),
|
|
if (!_isLogin)
|
|
TextFormField(
|
|
decoration: const InputDecoration(
|
|
labelText: 'Confirm Password',
|
|
prefixIcon: Icon(Icons.lock),
|
|
border: OutlineInputBorder(),
|
|
),
|
|
obscureText: true,
|
|
),
|
|
const SizedBox(height: 24),
|
|
FilledButton(
|
|
onPressed: () {},
|
|
style: FilledButton.styleFrom(
|
|
minimumSize: const Size(double.infinity, 50),
|
|
),
|
|
child: Text(
|
|
_isLogin ? 'LOGIN' : 'REGISTER',
|
|
style: const TextStyle(fontSize: 16),
|
|
),
|
|
),
|
|
const SizedBox(height: 12),
|
|
TextButton(
|
|
onPressed: _toggleAuthMode,
|
|
child: Text(
|
|
_isLogin
|
|
? 'Create new account'
|
|
: 'I already have an account',
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|