flutter_keaboard 0.1.4
flutter_keaboard: ^0.1.4 copied to clipboard
A new Flutter package project to detect keyboard events..
TODO: Put a short description of the package here that helps potential users know whether this package might be useful for them.
Features #
TODO: List what your package can do. Maybe include images, gifs, or videos.
Getting started #
just install the package and wrap your container inside the KeyboardAvoiderPkg difine et child and other
Usage #
TODO: Include short and useful examples for package users. Add longer examples
to /example
folder.
import 'package:Foodybite/widgets/big_blue_button.dart';
import 'package:Foodybite/widgets/text_button.dart';
import 'package:Foodybite/widgets/textinput_opacity.dart';
import 'package:flutter/material.dart';
// import 'package:keyboard_avoider/keyboard_avoider.dart';
import 'package:flutter_keaboard/flutter_keaboard.dart';
class RegisterScreen extends StatelessWidget { const RegisterScreen({Key? key}) : super(key: key);
@override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.transparent, resizeToAvoidBottomInset: true, // resizeToAvoidBottomPadding: false, body: KeyboardAvoiderPkg( autoScroll: true, child: Container( width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.height, decoration: BoxDecoration( image: DecorationImage( image: AssetImage('assets/images/Register.png'), fit: BoxFit.cover, ), ), child: Container( height: MediaQuery.of(context).size.height, decoration: BoxDecoration( color: Colors.black54, ), child: SingleChildScrollView( child: Column( children: [ SizedBox( height: 55, ), Stack( children: [ CircleAvatar( radius: 80.0, backgroundColor: Colors.white12, child: Icon( Icons.supervised_user_circle_outlined, size: 45, color: Colors.white, ), ), Positioned( top: 120, left: 110, child: CircleIconButton( icon: Icon( Icons.arrow_upward_rounded, size: 18, color: Colors.white, ), ), ) ], ), SizedBox(height: 110), TextInputOpacity( icon: Icon( Icons.supervised_user_circle_outlined, color: Colors.white, ), title: 'Nom(s)', ), SizedBox(height: 20), TextInputOpacity( icon: Icon( Icons.supervised_user_circle_outlined, color: Colors.white, ), title: 'Prénom(s)', ), SizedBox(height: 20), TextInputOpacity( icon: Icon( Icons.mail, color: Colors.white, ), title: 'Email', ), SizedBox(height: 20), TextInputOpacity( icon: Icon( Icons.lock, color: Colors.white, ), title: 'Password', ), SizedBox(height: 20), TextInputOpacity( icon: Icon( Icons.lock, color: Colors.white, ), title: 'Confirm Password', ), SizedBox(height: 55), BigBlueButton( title: 'Enregistrer', onPress: () { print('okay nous pouvons envoyer les données'); }, ), SizedBox(height: 55), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( 'Vous avez déjà un compte?', style: TextStyle( color: Colors.white, fontSize: 15, ), ), TextSimpleButton( title: 'Login', colors: Colors.blue, onPress: () { Navigator.pop(context); }, ), ], ) ], ), ), ), ), ), ); } }
class CircleIconButton extends StatelessWidget { const CircleIconButton({ Key? key, this.icon, this.onPress, }) : super(key: key); final Icon? icon; final Function? onPress; @override Widget build(BuildContext context) { return Container( width: 35, height: 35, decoration: BoxDecoration( color: Colors.blue, shape: BoxShape.circle, border: Border.all( color: Colors.white, ), ), child: IconButton( icon: icon ?? Icon(Icons.ac_unit), onPressed: () { (onPress ?? () {})(); }, ), ); } }
Additional information #
A lightweight alternative to the Scaffold widget for avoiding the on-screen software keyboard. Automatically scrolls obscured TextField child widgets into view on focus.
o auto-scroll to a focused widget such as a TextField, set the autoScroll property to true. If child is not a ScrollView, it is automatically embedded in a SingleChildScrollView to make it scrollable.