mirror of
https://github.com/Iconica-Development/flutter_login_widget.git
synced 2025-05-19 13:43:44 +02:00
less default padding more decoration options
This commit is contained in:
parent
3510fc4808
commit
f766c599ef
24 changed files with 165 additions and 108 deletions
|
@ -1,2 +0,0 @@
|
|||
# This is a generated file; do not edit or check into version control.
|
||||
smart_auth=C:\\Users\\miked\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\smart_auth-1.0.8\\
|
|
@ -1 +0,0 @@
|
|||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"smart_auth","path":"C:\\\\Users\\\\miked\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\smart_auth-1.0.8\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"smart_auth","path":"C:\\\\Users\\\\miked\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\smart_auth-1.0.8\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"smart_auth","path":"C:\\\\Users\\\\miked\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\smart_auth-1.0.8\\\\","native_build":true,"dependencies":[]}],"linux":[{"name":"smart_auth","path":"C:\\\\Users\\\\miked\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\smart_auth-1.0.8\\\\","native_build":true,"dependencies":[]}],"windows":[{"name":"smart_auth","path":"C:\\\\Users\\\\miked\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\smart_auth-1.0.8\\\\","native_build":true,"dependencies":[]}],"web":[{"name":"smart_auth","path":"C:\\\\Users\\\\miked\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\smart_auth-1.0.8\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"smart_auth","dependencies":[]}],"date_created":"2023-03-07 10:10:48.544860","version":"3.7.3"}
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -28,3 +28,6 @@ migrate_working_dir/
|
|||
.dart_tool/
|
||||
.packages
|
||||
build/
|
||||
|
||||
.flutter-plugins-dependencies
|
||||
.flutter-plugins
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
## 4.0.0
|
||||
* More decoration options less default padding
|
||||
|
||||
## 3.1.2
|
||||
* Added textStyle option for email and password fields
|
||||
|
||||
|
|
11
README.md
11
README.md
|
@ -7,17 +7,20 @@ A package facilitating the basic ingredients for creating functional yet customi
|
|||
|
||||
## Setup
|
||||
|
||||
To use this package, add `flutter_login_widget` as a dependency in your pubspec.yaml file.
|
||||
To use this package, add `flutter_login` as a dependency in your pubspec.yaml file.
|
||||
|
||||
## How to use
|
||||
|
||||
```dart
|
||||
final loginOptions = LoginOptions(
|
||||
decoration: const InputDecoration(
|
||||
emailDecoration: const InputDecoration(
|
||||
prefixIcon: Icon(Icons.email),
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
passwordDecoration: const InputDecoration(
|
||||
prefixIcon: Icon(Icons.password),
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
emailInputPrefix: const Icon(Icons.email),
|
||||
passwordInputPrefix: const Icon(Icons.password),
|
||||
title: const Text('Login'),
|
||||
image: const FlutterLogo(),
|
||||
requestForgotPasswordButtonBuilder: (context, onPressed, isDisabled) {
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
# example
|
||||
|
||||
A new Flutter project.
|
||||
|
||||
## Getting Started
|
||||
|
||||
This project is a starting point for a Flutter application.
|
||||
|
||||
A few resources to get you started if this is your first Flutter project:
|
||||
|
||||
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
|
||||
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
|
||||
|
||||
For help getting started with Flutter development, view the
|
||||
[online documentation](https://docs.flutter.dev/), which offers tutorials,
|
||||
samples, guidance on mobile development, and a full API reference.
|
|
@ -1 +1,2 @@
|
|||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
|
||||
#include "Generated.xcconfig"
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
|
||||
#include "Generated.xcconfig"
|
||||
|
|
41
example/ios/Podfile
Normal file
41
example/ios/Podfile
Normal file
|
@ -0,0 +1,41 @@
|
|||
# Uncomment this line to define a global platform for your project
|
||||
# platform :ios, '11.0'
|
||||
|
||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||
|
||||
project 'Runner', {
|
||||
'Debug' => :debug,
|
||||
'Profile' => :release,
|
||||
'Release' => :release,
|
||||
}
|
||||
|
||||
def flutter_root
|
||||
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
|
||||
unless File.exist?(generated_xcode_build_settings_path)
|
||||
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
|
||||
end
|
||||
|
||||
File.foreach(generated_xcode_build_settings_path) do |line|
|
||||
matches = line.match(/FLUTTER_ROOT\=(.*)/)
|
||||
return matches[1].strip if matches
|
||||
end
|
||||
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
|
||||
end
|
||||
|
||||
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
|
||||
|
||||
flutter_ios_podfile_setup
|
||||
|
||||
target 'Runner' do
|
||||
use_frameworks!
|
||||
use_modular_headers!
|
||||
|
||||
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
|
||||
end
|
||||
|
||||
post_install do |installer|
|
||||
installer.pods_project.targets.each do |target|
|
||||
flutter_additional_ios_build_settings(target)
|
||||
end
|
||||
end
|
|
@ -4,11 +4,14 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_login/flutter_login.dart';
|
||||
|
||||
final loginOptions = LoginOptions(
|
||||
decoration: const InputDecoration(
|
||||
emailDecoration: const InputDecoration(
|
||||
prefixIcon: Icon(Icons.email),
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
passwordDecoration: const InputDecoration(
|
||||
prefixIcon: Icon(Icons.password),
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
emailInputPrefix: const Icon(Icons.email),
|
||||
passwordInputPrefix: const Icon(Icons.password),
|
||||
title: const Text('Login Demo'),
|
||||
image: const FlutterLogo(
|
||||
size: 200,
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <smart_auth/smart_auth_plugin.h>
|
||||
|
||||
void fl_register_plugins(FlPluginRegistry* registry) {
|
||||
g_autoptr(FlPluginRegistrar) smart_auth_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "SmartAuthPlugin");
|
||||
smart_auth_plugin_register_with_registrar(smart_auth_registrar);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
smart_auth
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
|
||||
#include "ephemeral/Flutter-Generated.xcconfig"
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
|
||||
#include "ephemeral/Flutter-Generated.xcconfig"
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
import FlutterMacOS
|
||||
import Foundation
|
||||
|
||||
import smart_auth
|
||||
|
||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
SmartAuthPlugin.register(with: registry.registrar(forPlugin: "SmartAuthPlugin"))
|
||||
}
|
||||
|
|
40
example/macos/Podfile
Normal file
40
example/macos/Podfile
Normal file
|
@ -0,0 +1,40 @@
|
|||
platform :osx, '10.14'
|
||||
|
||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||
|
||||
project 'Runner', {
|
||||
'Debug' => :debug,
|
||||
'Profile' => :release,
|
||||
'Release' => :release,
|
||||
}
|
||||
|
||||
def flutter_root
|
||||
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
|
||||
unless File.exist?(generated_xcode_build_settings_path)
|
||||
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
|
||||
end
|
||||
|
||||
File.foreach(generated_xcode_build_settings_path) do |line|
|
||||
matches = line.match(/FLUTTER_ROOT\=(.*)/)
|
||||
return matches[1].strip if matches
|
||||
end
|
||||
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
|
||||
end
|
||||
|
||||
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
|
||||
|
||||
flutter_macos_podfile_setup
|
||||
|
||||
target 'Runner' do
|
||||
use_frameworks!
|
||||
use_modular_headers!
|
||||
|
||||
flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
|
||||
end
|
||||
|
||||
post_install do |installer|
|
||||
installer.pods_project.targets.each do |target|
|
||||
flutter_additional_macos_build_settings(target)
|
||||
end
|
||||
end
|
|
@ -68,7 +68,7 @@ packages:
|
|||
path: ".."
|
||||
relative: true
|
||||
source: path
|
||||
version: "3.1.2"
|
||||
version: "4.0.0"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <smart_auth/smart_auth_plugin.h>
|
||||
|
||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||
SmartAuthPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("SmartAuthPlugin"));
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
smart_auth
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
|
|
|
@ -9,13 +9,10 @@ class LoginOptions {
|
|||
this.image,
|
||||
this.title,
|
||||
this.subtitle,
|
||||
this.emailLabel,
|
||||
this.passwordLabel,
|
||||
this.emailInputPrefix,
|
||||
this.passwordInputPrefix,
|
||||
this.emailTextStyle,
|
||||
this.passwordTextStyle,
|
||||
this.decoration = const InputDecoration(),
|
||||
this.emailDecoration = const InputDecoration(),
|
||||
this.passwordDecoration = const InputDecoration(),
|
||||
this.initialEmail = '',
|
||||
this.initialPassword = '',
|
||||
this.translations = const LoginTranslations(),
|
||||
|
@ -27,8 +24,6 @@ class LoginOptions {
|
|||
this.registrationButtonBuilder = _createRegisterButton,
|
||||
this.emailInputContainerBuilder = _createEmailInputContainer,
|
||||
this.passwordInputContainerBuilder = _createPasswordInputContainer,
|
||||
this.emailHintText,
|
||||
this.passwordHintText,
|
||||
});
|
||||
|
||||
final ButtonBuilder loginButtonBuilder;
|
||||
|
@ -41,15 +36,10 @@ class LoginOptions {
|
|||
final Widget? image;
|
||||
final Widget? title;
|
||||
final Widget? subtitle;
|
||||
final Widget? emailLabel;
|
||||
final Widget? passwordLabel;
|
||||
final Widget? emailInputPrefix;
|
||||
final Widget? passwordInputPrefix;
|
||||
final InputDecoration decoration;
|
||||
final InputDecoration emailDecoration;
|
||||
final InputDecoration passwordDecoration;
|
||||
final String initialEmail;
|
||||
final String initialPassword;
|
||||
final String? emailHintText;
|
||||
final String? passwordHintText;
|
||||
final TextStyle? emailTextStyle;
|
||||
final TextStyle? passwordTextStyle;
|
||||
final LoginTranslations translations;
|
||||
|
@ -79,9 +69,15 @@ class LoginTranslations {
|
|||
final String registrationButton;
|
||||
}
|
||||
|
||||
Widget _createEmailInputContainer(Widget child) => child;
|
||||
Widget _createEmailInputContainer(Widget child) => Padding(
|
||||
padding: const EdgeInsets.only(bottom: 15),
|
||||
child: child,
|
||||
);
|
||||
|
||||
Widget _createPasswordInputContainer(Widget child) => child;
|
||||
Widget _createPasswordInputContainer(Widget child) => Padding(
|
||||
padding: const EdgeInsets.only(bottom: 15),
|
||||
child: child,
|
||||
);
|
||||
|
||||
Widget _createLoginButton(
|
||||
BuildContext context,
|
||||
|
|
|
@ -133,14 +133,9 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
|
|||
keyboardType: TextInputType.emailAddress,
|
||||
textInputAction: TextInputAction.next,
|
||||
style: options.emailTextStyle,
|
||||
decoration: options.decoration.copyWith(
|
||||
hintText: options.emailHintText,
|
||||
prefixIcon: options.emailInputPrefix,
|
||||
label: options.emailLabel,
|
||||
decoration: options.emailDecoration,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
options.passwordInputContainerBuilder(
|
||||
TextFormField(
|
||||
obscureText: _obscurePassword,
|
||||
|
@ -152,10 +147,7 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
|
|||
textInputAction: TextInputAction.done,
|
||||
style: options.passwordTextStyle,
|
||||
onFieldSubmitted: (_) => _handleLogin(),
|
||||
decoration: options.decoration.copyWith(
|
||||
hintText: options.passwordHintText,
|
||||
label: options.passwordLabel,
|
||||
prefixIcon: options.passwordInputPrefix,
|
||||
decoration: options.passwordDecoration.copyWith(
|
||||
suffixIcon: IconButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
|
@ -171,7 +163,6 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
|
|||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
if (widget.onForgotPassword != null) ...[
|
||||
Align(
|
||||
alignment: Alignment.topRight,
|
||||
|
|
|
@ -65,41 +65,28 @@ class _ForgotPasswordFormState extends State<ForgotPasswordForm> {
|
|||
var theme = Theme.of(context);
|
||||
return Form(
|
||||
key: _formKey,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 32,
|
||||
vertical: 16,
|
||||
),
|
||||
child: _wrapWithDefaultStyle(
|
||||
widget.title,
|
||||
theme.textTheme.displaySmall,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 32,
|
||||
vertical: 16,
|
||||
),
|
||||
child: _wrapWithDefaultStyle(
|
||||
widget.description,
|
||||
theme.textTheme.bodyMedium,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Align(
|
||||
child: options.emailInputContainerBuilder(
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: 300,
|
||||
),
|
||||
child: TextFormField(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_wrapWithDefaultStyle(
|
||||
widget.title,
|
||||
theme.textTheme.displaySmall,
|
||||
) ??
|
||||
const SizedBox.shrink(),
|
||||
_wrapWithDefaultStyle(
|
||||
widget.description,
|
||||
theme.textTheme.bodyMedium,
|
||||
) ??
|
||||
const SizedBox.shrink(),
|
||||
Expanded(
|
||||
child: Align(
|
||||
child: options.emailInputContainerBuilder(
|
||||
TextFormField(
|
||||
focusNode: _focusNode,
|
||||
onChanged: _updateCurrentEmail,
|
||||
validator: widget.options.validations.validateEmail,
|
||||
|
@ -107,18 +94,12 @@ class _ForgotPasswordFormState extends State<ForgotPasswordForm> {
|
|||
keyboardType: TextInputType.emailAddress,
|
||||
textInputAction: TextInputAction.next,
|
||||
style: options.emailTextStyle,
|
||||
decoration: options.decoration.copyWith(
|
||||
prefixIcon: options.emailInputPrefix,
|
||||
label: options.emailLabel,
|
||||
decoration: options.emailDecoration,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: AnimatedBuilder(
|
||||
AnimatedBuilder(
|
||||
animation: _formValid,
|
||||
builder: (context, snapshot) {
|
||||
return Align(
|
||||
|
@ -139,9 +120,9 @@ class _ForgotPasswordFormState extends State<ForgotPasswordForm> {
|
|||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: flutter_login
|
||||
description: Flutter Login Component
|
||||
version: 3.1.2
|
||||
version: 4.0.0
|
||||
|
||||
environment:
|
||||
sdk: ">=2.18.1 <3.0.0"
|
||||
|
|
Loading…
Reference in a new issue