Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 17 additions & 34 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,15 @@ class HomePage extends StatelessWidget {
title: Row(
mainAxisSize: MainAxisSize.min,
children: [
Image.asset(
'assets/logo.png',
width: 24,
height: 24,
),
Image.asset('assets/logo.png', width: 24, height: 24),
const SizedBox(width: 10),
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'Virtual Keypad',
style: TextStyle(
fontWeight: FontWeight.w800,
fontSize: 18,
),
style: TextStyle(fontWeight: FontWeight.w800, fontSize: 18),
),
Text(
'Flutter on-screen keyboard',
Expand All @@ -92,10 +85,7 @@ class HomePage extends StatelessWidget {
body: ListView(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 24),
children: [
const _SectionHeader(
title: 'Input Types',
icon: Icons.input_rounded,
),
const _SectionHeader(title: 'Input Types', icon: Icons.input_rounded),
_ExampleCard(
icon: Icons.dialpad_rounded,
title: 'Numeric Input',
Expand Down Expand Up @@ -144,10 +134,7 @@ class HomePage extends StatelessWidget {
onTap: () => _navigate(context, const MultilineTextExample()),
),
const SizedBox(height: 4),
const _SectionHeader(
title: 'Features',
icon: Icons.stars_rounded,
),
const _SectionHeader(title: 'Features', icon: Icons.stars_rounded),
_ExampleCard(
icon: Icons.bolt_rounded,
title: 'Standalone Mode',
Expand All @@ -160,8 +147,7 @@ class HomePage extends StatelessWidget {
title: 'Auto-Hide Keyboard',
subtitle: 'Focus-aware animated transitions',
gradient: const [Color(0xFF30cfd0), Color(0xFF330867)],
onTap: () =>
_navigate(context, const AutoHideKeyboardExample()),
onTap: () => _navigate(context, const AutoHideKeyboardExample()),
),
_ExampleCard(
icon: Icons.palette_rounded,
Expand All @@ -175,8 +161,7 @@ class HomePage extends StatelessWidget {
title: 'Language Switching',
subtitle: 'Toggle English ↔ Bengali ↔ French',
gradient: const [Color(0xFF89f7fe), Color(0xFF66a6ff)],
onTap: () =>
_navigate(context, const LanguageSwitchingExample()),
onTap: () => _navigate(context, const LanguageSwitchingExample()),
),
],
),
Expand All @@ -190,18 +175,15 @@ class HomePage extends StatelessWidget {
pageBuilder: (context, animation, secondaryAnimation) => page,
transitionsBuilder: (context, animation, secondaryAnimation, child) {
return FadeTransition(
opacity: CurvedAnimation(
parent: animation,
curve: Curves.easeOut,
),
opacity: CurvedAnimation(parent: animation, curve: Curves.easeOut),
child: SlideTransition(
position: Tween<Offset>(
begin: const Offset(0.04, 0),
end: Offset.zero,
).animate(CurvedAnimation(
parent: animation,
curve: Curves.easeOut,
)),
position:
Tween<Offset>(
begin: const Offset(0.04, 0),
end: Offset.zero,
).animate(
CurvedAnimation(parent: animation, curve: Curves.easeOut),
),
child: child,
),
);
Expand Down Expand Up @@ -351,8 +333,9 @@ class _ExampleCard extends StatelessWidget {
subtitle,
style: TextStyle(
fontSize: 12,
color:
colorScheme.onSurface.withValues(alpha: 0.55),
color: colorScheme.onSurface.withValues(
alpha: 0.55,
),
),
),
],
Expand Down
53 changes: 29 additions & 24 deletions example/lib/screens/auto_hide_keyboard_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,19 @@ class _AutoHideKeyboardExampleState extends State<AutoHideKeyboardExample> {
borderRadius: BorderRadius.circular(14),
boxShadow: [
BoxShadow(
color: (_isAnyFocused
? const Color(0xFF30cfd0)
: colorScheme.shadow)
.withValues(alpha: 0.1),
color:
(_isAnyFocused
? const Color(0xFF30cfd0)
: colorScheme.shadow)
.withValues(alpha: 0.1),
blurRadius: 12,
offset: const Offset(0, 3),
),
],
border: Border.all(
color: colorScheme.outlineVariant
.withValues(alpha: 0.1),
color: colorScheme.outlineVariant.withValues(
alpha: 0.1,
),
),
),
child: ClipRRect(
Expand All @@ -99,30 +101,32 @@ class _AutoHideKeyboardExampleState extends State<AutoHideKeyboardExample> {
left: BorderSide(
color: _isAnyFocused
? const Color(0xFF30cfd0)
: colorScheme.outlineVariant
.withValues(alpha: 0.4),
: colorScheme.outlineVariant.withValues(
alpha: 0.4,
),
width: 4,
),
),
),
child: Row(
children: [
AnimatedContainer(
duration:
const Duration(milliseconds: 300),
duration: const Duration(milliseconds: 300),
width: 10,
height: 10,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: _isAnyFocused
? const Color(0xFF30cfd0)
: colorScheme.outline
.withValues(alpha: 0.35),
: colorScheme.outline.withValues(
alpha: 0.35,
),
boxShadow: _isAnyFocused
? [
BoxShadow(
color: const Color(0xFF30cfd0)
.withValues(alpha: 0.5),
color: const Color(
0xFF30cfd0,
).withValues(alpha: 0.5),
blurRadius: 8,
spreadRadius: 1,
),
Expand Down Expand Up @@ -163,17 +167,17 @@ class _AutoHideKeyboardExampleState extends State<AutoHideKeyboardExample> {
),
),
AnimatedSwitcher(
duration:
const Duration(milliseconds: 300),
duration: const Duration(milliseconds: 300),
child: Icon(
_isAnyFocused
? Icons.keyboard_rounded
: Icons.keyboard_hide_rounded,
key: ValueKey(_isAnyFocused),
color: _isAnyFocused
? const Color(0xFF30cfd0)
: colorScheme.outline
.withValues(alpha: 0.35),
: colorScheme.outline.withValues(
alpha: 0.35,
),
size: 22,
),
),
Expand Down Expand Up @@ -208,8 +212,7 @@ class _AutoHideKeyboardExampleState extends State<AutoHideKeyboardExample> {
width: 2,
),
),
prefixIcon:
const Icon(Icons.text_fields_rounded),
prefixIcon: const Icon(Icons.text_fields_rounded),
filled: true,
fillColor: colorScheme.surfaceContainerLowest,
contentPadding: const EdgeInsets.symmetric(
Expand Down Expand Up @@ -264,8 +267,7 @@ class _AutoHideKeyboardExampleState extends State<AutoHideKeyboardExample> {
borderRadius: BorderRadius.circular(16),
borderSide: BorderSide.none,
),
prefixIcon:
const Icon(Icons.lock_outline_rounded),
prefixIcon: const Icon(Icons.lock_outline_rounded),
filled: true,
fillColor: colorScheme.surfaceContainerHighest
.withValues(alpha: 0.5),
Expand Down Expand Up @@ -308,8 +310,11 @@ class _SectionLabel extends StatelessWidget {
children: [
Row(
children: [
Icon(icon, size: 18,
color: colorScheme.onSurface.withValues(alpha: 0.7)),
Icon(
icon,
size: 18,
color: colorScheme.onSurface.withValues(alpha: 0.7),
),
const SizedBox(width: 8),
Text(
label.toUpperCase(),
Expand Down
44 changes: 20 additions & 24 deletions example/lib/screens/custom_theme_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -127,32 +127,32 @@ class _CustomThemeExampleState extends State<CustomThemeExample> {
onTap: () =>
setState(() => _selectedTheme = index),
child: AnimatedContainer(
duration:
const Duration(milliseconds: 250),
duration: const Duration(milliseconds: 250),
padding: const EdgeInsets.symmetric(
horizontal: 20,
vertical: 10,
),
decoration: BoxDecoration(
color: isSelected
? theme.accent
.withValues(alpha: 0.2)
: current.appBarBg
.withValues(alpha: 0.6),
? theme.accent.withValues(alpha: 0.2)
: current.appBarBg.withValues(
alpha: 0.6,
),
borderRadius: BorderRadius.circular(26),
border: Border.all(
color: isSelected
? theme.accent
.withValues(alpha: 0.6)
: current.textColor
.withValues(alpha: 0.08),
? theme.accent.withValues(alpha: 0.6)
: current.textColor.withValues(
alpha: 0.08,
),
width: isSelected ? 2 : 1,
),
boxShadow: isSelected
? [
BoxShadow(
color: theme.accent
.withValues(alpha: 0.25),
color: theme.accent.withValues(
alpha: 0.25,
),
blurRadius: 12,
offset: const Offset(0, 3),
),
Expand All @@ -164,8 +164,7 @@ class _CustomThemeExampleState extends State<CustomThemeExample> {
children: [
Text(
theme.emoji,
style:
const TextStyle(fontSize: 18),
style: const TextStyle(fontSize: 18),
),
const SizedBox(width: 8),
Text(
Expand All @@ -177,8 +176,9 @@ class _CustomThemeExampleState extends State<CustomThemeExample> {
: FontWeight.w400,
color: isSelected
? theme.accent
: current.textColor
.withValues(alpha: 0.55),
: current.textColor.withValues(
alpha: 0.55,
),
),
),
],
Expand Down Expand Up @@ -239,13 +239,11 @@ class _CustomThemeExampleState extends State<CustomThemeExample> {
decoration: InputDecoration(
labelText: 'Type here',
labelStyle: TextStyle(
color:
current.textColor.withValues(alpha: 0.5),
color: current.textColor.withValues(alpha: 0.5),
),
hintText: 'Try the themed keyboard',
hintStyle: TextStyle(
color:
current.textColor.withValues(alpha: 0.2),
color: current.textColor.withValues(alpha: 0.2),
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(16),
Expand All @@ -254,8 +252,7 @@ class _CustomThemeExampleState extends State<CustomThemeExample> {
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(16),
borderSide: BorderSide(
color:
current.accent.withValues(alpha: 0.15),
color: current.accent.withValues(alpha: 0.15),
),
),
focusedBorder: OutlineInputBorder(
Expand All @@ -269,8 +266,7 @@ class _CustomThemeExampleState extends State<CustomThemeExample> {
fillColor: current.theme.keyColor,
prefixIcon: Icon(
Icons.palette_outlined,
color:
current.textColor.withValues(alpha: 0.35),
color: current.textColor.withValues(alpha: 0.35),
),
contentPadding: const EdgeInsets.symmetric(
horizontal: 18,
Expand Down
Loading