initial commit

This commit is contained in:
Patrick Alvin Alcala 2025-01-20 16:20:36 +08:00
commit f1db550ee7
128 changed files with 5407 additions and 0 deletions

BIN
lib/assets/ph_logo.webp Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

28
lib/commands/signup.dart Normal file
View file

@ -0,0 +1,28 @@
import 'package:supabase_flutter/supabase_flutter.dart';
import 'package:pharmacy_mobile/main.dart';
Future<void> signUp() async {
try {
await supabase.auth.signUp(
email: email,
password: password,
);
// if (mounted) {
// context.showSnackBar('Check your email for a login link!');
// _emailController.clear();
// }
} on AuthException catch (error) {
if (mounted) context.showSnackBar(error.message, isError: true);
} catch (error) {
if (mounted) {
context.showSnackBar('Unexpected error occurred', isError: true);
}
} finally {
if (mounted) {
setState(() {
_isLoading = false;
});
}
}
}

58
lib/main.dart Normal file
View file

@ -0,0 +1,58 @@
import 'package:flutter/material.dart';
import 'package:pharmacy_mobile/pages/index_page.dart';
import 'package:pharmacy_mobile/pages/login_page.dart';
import 'package:go_router/go_router.dart';
import 'package:supabase_flutter/supabase_flutter.dart';
// void main() {
// runApp(const MyApp());
// }
Future<void> main() async {
await Supabase.initialize(
url: 'https://lijihnvjlucyvxfhghqd.supabase.co',
anonKey:
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImxpamlobnZqbHVjeXZ4ZmhnaHFkIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjQ1NjEyODYsImV4cCI6MjA0MDEzNzI4Nn0.N3_FLKm02OdprL9m3P0CzuV8kdbCrrJKaVdtgVR3PSk',
);
runApp(MyApp());
}
final supabase = Supabase.instance.client;
final _router = GoRouter(
initialLocation: '/',
routes: [
GoRoute(
name: 'index', // Optional, add name to your routes. Allows you navigate by name instead of path
path: '/',
builder: (context, state) => IndexPage(),
),
GoRoute(
name: 'login',
path: '/login',
builder: (context, state) => LoginPage(),
),
],
);
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp.router(
// initialRoute: '/',
// routes: {
// '/': (context) => const IndexPage(),
// '/login': (context) => const LoginPage(),
// },
// debugShowCheckedModeBanner: false,
// theme: ThemeData(
// colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
// useMaterial3: true,
// )
routerConfig: _router,
);
}
}

50
lib/pages/index_page.dart Normal file
View file

@ -0,0 +1,50 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:gap/gap.dart';
class IndexPage extends StatelessWidget {
const IndexPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
body: Container(
alignment: Alignment.center,
height: MediaQuery.of(context).size.height,
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: [
Color.fromRGBO(34, 51, 69, 1),
Color.fromRGBO(22, 32, 44, 1),
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
const Gap(120),
Text('Ofelia Franco-Alcala',
style: GoogleFonts.outfit(
textStyle: const TextStyle(color: Color.fromRGBO(255, 255, 255, 1), fontSize: 32))),
Text('Pharmacy',
style: GoogleFonts.outfit(
textStyle: const TextStyle(color: Color.fromRGBO(255, 255, 255, 1), fontSize: 40))),
const Gap(32),
Padding(
padding: const EdgeInsets.fromLTRB(0, 0, 16, 0),
child: Image.asset('assets/ph_logo.webp',
width: 256, cacheWidth: (256 * MediaQuery.of(context).devicePixelRatio).round()),
),
const Gap(16),
TextButton(onPressed: () => {context.push('/login')}, child: Text('data'))
],
),
),
));
}
}

120
lib/pages/login_page.dart Normal file
View file

@ -0,0 +1,120 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:gap/gap.dart';
class LoginPage extends StatelessWidget {
const LoginPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
alignment: Alignment.center,
height: MediaQuery.of(context).size.height,
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: [
Color.fromRGBO(34, 51, 69, 1),
Color.fromRGBO(22, 32, 44, 1),
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
const Gap(120),
Text('Ofelia Franco-Alcala',
style: GoogleFonts.outfit(
textStyle: const TextStyle(color: Color.fromRGBO(255, 255, 255, 1), fontSize: 16))),
Text('Pharmacy',
style: GoogleFonts.outfit(
textStyle: const TextStyle(color: Color.fromRGBO(255, 255, 255, 1), fontSize: 32))),
const Gap(32),
Text('Login',
style: GoogleFonts.outfit(
textStyle: const TextStyle(color: Color.fromRGBO(255, 255, 255, 1), fontSize: 32))),
const Gap(16),
Padding(
padding: const EdgeInsets.only(left: 16, right: 16),
child: Container(
padding: EdgeInsets.all(16),
decoration: BoxDecoration(
border: Border.all(color: Colors.white), borderRadius: BorderRadius.all(Radius.circular(16))),
child: Form(
child: Column(
children: [
TextFormField(
decoration: InputDecoration(
labelText: 'Email',
border: OutlineInputBorder(),
)),
const Gap(8),
TextFormField(
decoration: InputDecoration(
labelText: 'Password',
border: OutlineInputBorder(),
)),
const Gap(16),
TextButton(onPressed: () => {}, child: Text('Login'))
],
)),
),
),
// Form(
// child: Column(
// children: [
// TextFormField(
// decoration: InputDecoration(
// labelText: 'Email',
// border: OutlineInputBorder(),
// ),
// validator: (value) {
// if (value.isEmpty) {
// return 'Please enter an email';
// }
// return null;
// },
// onSaved: (value) => _email = value,
// ),
// SizedBox(height: 20),
// TextFormField(
// decoration: InputDecoration(
// labelText: 'Password',
// border: OutlineInputBorder(),
// ),
// obscureText: true,
// validator: (value) {
// if (value.isEmpty) {
// return 'Please enter a password';
// }
// return null;
// },
// onSaved: (value) => _password = value,
// ),
// SizedBox(height: 20),
// ElevatedButton(
// onPressed: () {
// if (_formKey.currentState.validate()) {
// _formKey.currentState.save();
// // Login logic here
// print('Email: $_email, Password: $_password');
// }
// },
// child: Text('Login'),
// ),
// ],
// ),
// ),
// )
// )
],
),
),
));
}
}

View file

@ -0,0 +1,9 @@
import 'package:supabase_flutter/supabase_flutter.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
Future<void> supabase() async {
await Supabase.initialize(
url: dotenv.env['SUPABASE_URL'],
anonKey: dotenv.env['SUPABASE_ANONKEY'],
);
}