From 2b8c2b5e625fcf6ac2acb70e5750d7a1bf72ef3b Mon Sep 17 00:00:00 2001 From: Joey Boerwinkel Date: Fri, 30 Sep 2022 12:28:41 +0200 Subject: [PATCH] chore: add readme description and versioning --- README.md | 112 ++++++++++++++++++++++++++++++++++++++------------- pubspec.yaml | 4 +- 2 files changed, 86 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 02fe8ec..111dc25 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,95 @@ - - -TODO: Put a short description of the package here that helps potential users -know whether this package might be useful for them. +A package facilitating the basic ingredients for creating functional yet customizable login pages ## Features -TODO: List what your package can do. Maybe include images, gifs, or videos. +Create a login screen for email and password logins +Create a forgot password screen by passing in the email from the login ## Getting started -TODO: List prerequisites and provide or point to information on how to -start using the package. +1. install the package by adding the following to your pubspec.yaml + ``` + flutter_login: + git: + url: https://github.com/Iconica-Development/flutter_login.git + ref: 1.0.0 + ``` ## Usage -TODO: Include short and useful examples for package users. Add longer examples -to `/example` folder. - ```dart -const like = 'sample'; +final loginOptions = LoginOptions( + decoration: const InputDecoration( + border: OutlineInputBorder(), + ), + emailInputPrefix: const Icon(Icons.email), + passwordInputPrefix: const Icon(Icons.password), + title: const Text('Login'), + image: const FlutterLogo(), + requestForgotPasswordButtonBuilder: (context, onPressed, isDisabled) { + return Opacity( + opacity: isDisabled ? 0.5 : 1.0, + child: ElevatedButton( + onPressed: onPressed, + child: const Text('Send request'), + ), + ); + }, +); + +class LoginExample extends StatelessWidget { + const LoginExample({super.key}); + + @override + Widget build(BuildContext context) { + return MaterialApp( + theme: ThemeData.dark(), + home: LoginScreen(), + ); + } +} + +class LoginScreen extends StatelessWidget { + const LoginScreen({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + body: EmailPasswordLoginForm( + options: loginOptions, + onLogin: (email, password) => print('$email:$password'), + onRegister: (email, password) => print('Register!'), + onForgotPassword: (email) { + Navigator.of(context).push( + MaterialPageRoute( + builder: (context) { + return const ForgotPasswordScreen(); + }, + ), + ); + }, + ), + ); + } +} + +class ForgotPasswordScreen extends StatelessWidget { + const ForgotPasswordScreen({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(), + body: ForgotPasswordForm( + options: loginOptions, + title: Text('Forgot password'), + description: Text('Hello world'), + onRequestForgotPassword: (email) { + print('Forgot password email sent to $email'); + }, + ), + ); + } +} + ``` - -## Additional information - -TODO: Tell users more about the package: where to find more information, how to -contribute to the package, how to file issues, what response they can expect -from the package authors, and more. diff --git a/pubspec.yaml b/pubspec.yaml index a7c2678..74d5c1d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,9 +1,9 @@ name: flutter_login description: A new Flutter package project. -version: 0.0.1 +version: 1.0.0 environment: - sdk: '>=2.18.1 <3.0.0' + sdk: ">=2.18.1 <3.0.0" flutter: ">=1.17.0" dependencies: