mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2025-12-07 11:39:29 +00:00
fix: bug login not shown for some languages (#73)
* fix language preventing logging in * make eye blink once
This commit is contained in:
parent
4663ff9094
commit
28ceca5408
4 changed files with 162 additions and 132 deletions
|
|
@ -13,6 +13,37 @@ class OnboardingSinglePage extends HookConsumerWidget {
|
||||||
super.key,
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
return Scaffold(
|
||||||
|
body: LayoutBuilder(
|
||||||
|
builder: (BuildContext context, BoxConstraints constraints) {
|
||||||
|
return Center(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: ConstrainedBox(
|
||||||
|
constraints: BoxConstraints(
|
||||||
|
maxWidth: 600,
|
||||||
|
minWidth:
|
||||||
|
constraints.maxWidth < 600 ? constraints.maxWidth : 0,
|
||||||
|
),
|
||||||
|
child: const Padding(
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 20.0),
|
||||||
|
child: SafeArea(child: OnboardingBody()),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class OnboardingBody extends HookConsumerWidget {
|
||||||
|
const OnboardingBody({
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final apiSettings = ref.watch(apiSettingsProvider);
|
final apiSettings = ref.watch(apiSettingsProvider);
|
||||||
|
|
@ -39,65 +70,65 @@ class OnboardingSinglePage extends HookConsumerWidget {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Column(
|
||||||
body: SingleChildScrollView(
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
child: Column(
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
children: [
|
||||||
children: [
|
Padding(
|
||||||
Padding(
|
padding: const EdgeInsets.all(8.0),
|
||||||
padding: const EdgeInsets.all(8.0),
|
child: Text(
|
||||||
child: Text(
|
'Welcome to Vaani',
|
||||||
'Welcome to Vaani',
|
style: Theme.of(context).textTheme.headlineSmall,
|
||||||
style: Theme.of(context).textTheme.headlineSmall,
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox.square(
|
|
||||||
dimension: 16.0,
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: AnimatedSwitcher(
|
|
||||||
duration: 500.ms,
|
|
||||||
transitionBuilder: fadeSlideTransitionBuilder,
|
|
||||||
child: canUserLogin.value
|
|
||||||
? Text(
|
|
||||||
'Server connected, please login',
|
|
||||||
key: const ValueKey('connected'),
|
|
||||||
style: Theme.of(context).textTheme.bodyMedium,
|
|
||||||
)
|
|
||||||
: Text(
|
|
||||||
'Please enter the URL of your AudiobookShelf Server',
|
|
||||||
key: const ValueKey('not_connected'),
|
|
||||||
style: Theme.of(context).textTheme.bodyMedium,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: AddNewServer(
|
|
||||||
controller: serverUriController,
|
|
||||||
allowEmpty: true,
|
|
||||||
onPressed: () {
|
|
||||||
canUserLogin.value = serverUriController.text.isNotEmpty;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
AnimatedSwitcher(
|
|
||||||
duration: 500.ms,
|
|
||||||
transitionBuilder: fadeSlideTransitionBuilder,
|
|
||||||
child: canUserLogin.value
|
|
||||||
? UserLoginWidget(
|
|
||||||
server: audiobookshelfUri,
|
|
||||||
)
|
|
||||||
// ).animate().fade(duration: 600.ms).slideY(begin: 0.3, end: 0)
|
|
||||||
: const RedirectToABS().animate().fadeIn().slideY(
|
|
||||||
curve: Curves.easeInOut,
|
|
||||||
duration: 500.ms,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
const SizedBox.square(
|
||||||
|
dimension: 16.0,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: AnimatedSwitcher(
|
||||||
|
duration: 500.ms,
|
||||||
|
transitionBuilder: fadeSlideTransitionBuilder,
|
||||||
|
child: canUserLogin.value
|
||||||
|
? Text(
|
||||||
|
'Server connected, please login',
|
||||||
|
key: const ValueKey('connected'),
|
||||||
|
style: Theme.of(context).textTheme.bodyMedium,
|
||||||
|
)
|
||||||
|
: Text(
|
||||||
|
'Please enter the URL of your AudiobookShelf Server',
|
||||||
|
key: const ValueKey('not_connected'),
|
||||||
|
style: Theme.of(context).textTheme.bodyMedium,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: AddNewServer(
|
||||||
|
controller: serverUriController,
|
||||||
|
allowEmpty: true,
|
||||||
|
onPressed: () {
|
||||||
|
canUserLogin.value = serverUriController.text.isNotEmpty;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox.square(
|
||||||
|
dimension: 16.0,
|
||||||
|
),
|
||||||
|
AnimatedSwitcher(
|
||||||
|
duration: 500.ms,
|
||||||
|
transitionBuilder: fadeSlideTransitionBuilder,
|
||||||
|
child: canUserLogin.value
|
||||||
|
? UserLoginWidget(
|
||||||
|
server: audiobookshelfUri,
|
||||||
|
)
|
||||||
|
// ).animate().fade(duration: 600.ms).slideY(begin: 0.3, end: 0)
|
||||||
|
: const RedirectToABS().animate().fadeIn().slideY(
|
||||||
|
curve: Curves.easeInOut,
|
||||||
|
duration: 500.ms,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -130,11 +130,11 @@ class UserLoginMultipleAuth extends HookConsumerWidget {
|
||||||
return Center(
|
return Center(
|
||||||
child: InactiveFocusScopeObserver(
|
child: InactiveFocusScopeObserver(
|
||||||
child: AutofillGroup(
|
child: AutofillGroup(
|
||||||
child: Padding(
|
child: Column(
|
||||||
padding: const EdgeInsets.all(8.0),
|
children: [
|
||||||
child: Column(
|
Padding(
|
||||||
children: [
|
padding: const EdgeInsets.all(8.0),
|
||||||
Wrap(
|
child: Wrap(
|
||||||
// mainAxisAlignment: MainAxisAlignment.center,
|
// mainAxisAlignment: MainAxisAlignment.center,
|
||||||
spacing: 10,
|
spacing: 10,
|
||||||
runAlignment: WrapAlignment.center,
|
runAlignment: WrapAlignment.center,
|
||||||
|
|
@ -174,10 +174,11 @@ class UserLoginMultipleAuth extends HookConsumerWidget {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox.square(
|
),
|
||||||
dimension: 8,
|
|
||||||
),
|
Padding(
|
||||||
switch (methodChoice.value) {
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: switch (methodChoice.value) {
|
||||||
AuthMethodChoice.authToken => UserLoginWithToken(
|
AuthMethodChoice.authToken => UserLoginWithToken(
|
||||||
server: server,
|
server: server,
|
||||||
addServer: addServer,
|
addServer: addServer,
|
||||||
|
|
@ -192,8 +193,8 @@ class UserLoginMultipleAuth extends HookConsumerWidget {
|
||||||
openIDButtonText: openIDButtonText,
|
openIDButtonText: openIDButtonText,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ class UserLoginWithPassword extends HookConsumerWidget {
|
||||||
final usernameController = useTextEditingController();
|
final usernameController = useTextEditingController();
|
||||||
final passwordController = useTextEditingController();
|
final passwordController = useTextEditingController();
|
||||||
final isPasswordVisibleAnimationController = useAnimationController(
|
final isPasswordVisibleAnimationController = useAnimationController(
|
||||||
|
initialValue: 1,
|
||||||
duration: const Duration(milliseconds: 500),
|
duration: const Duration(milliseconds: 500),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -92,76 +93,73 @@ class UserLoginWithPassword extends HookConsumerWidget {
|
||||||
return Center(
|
return Center(
|
||||||
child: InactiveFocusScopeObserver(
|
child: InactiveFocusScopeObserver(
|
||||||
child: AutofillGroup(
|
child: AutofillGroup(
|
||||||
child: Padding(
|
child: Column(
|
||||||
padding: const EdgeInsets.all(8.0),
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
child: Column(
|
children: [
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
TextFormField(
|
||||||
children: [
|
controller: usernameController,
|
||||||
TextFormField(
|
autofocus: true,
|
||||||
controller: usernameController,
|
autofillHints: const [AutofillHints.username],
|
||||||
autofocus: true,
|
textInputAction: TextInputAction.next,
|
||||||
autofillHints: const [AutofillHints.username],
|
decoration: InputDecoration(
|
||||||
textInputAction: TextInputAction.next,
|
labelText: 'Username',
|
||||||
decoration: InputDecoration(
|
labelStyle: TextStyle(
|
||||||
labelText: 'Username',
|
color: Theme.of(context)
|
||||||
labelStyle: TextStyle(
|
.colorScheme
|
||||||
color: Theme.of(context)
|
.onSurface
|
||||||
.colorScheme
|
.withOpacity(0.8),
|
||||||
.onSurface
|
|
||||||
.withOpacity(0.8),
|
|
||||||
),
|
|
||||||
border: const OutlineInputBorder(),
|
|
||||||
),
|
),
|
||||||
|
border: const OutlineInputBorder(),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
),
|
||||||
TextFormField(
|
const SizedBox(height: 10),
|
||||||
controller: passwordController,
|
TextFormField(
|
||||||
autofillHints: const [AutofillHints.password],
|
controller: passwordController,
|
||||||
textInputAction: TextInputAction.done,
|
autofillHints: const [AutofillHints.password],
|
||||||
obscureText: !isPasswordVisible.value,
|
textInputAction: TextInputAction.done,
|
||||||
onFieldSubmitted: (_) {
|
obscureText: !isPasswordVisible.value,
|
||||||
loginAndSave();
|
onFieldSubmitted: (_) {
|
||||||
},
|
loginAndSave();
|
||||||
decoration: InputDecoration(
|
},
|
||||||
labelText: 'Password',
|
decoration: InputDecoration(
|
||||||
labelStyle: TextStyle(
|
labelText: 'Password',
|
||||||
color: Theme.of(context)
|
labelStyle: TextStyle(
|
||||||
.colorScheme
|
color: Theme.of(context)
|
||||||
.onSurface
|
.colorScheme
|
||||||
.withOpacity(0.8),
|
.onSurface
|
||||||
|
.withOpacity(0.8),
|
||||||
|
),
|
||||||
|
border: const OutlineInputBorder(),
|
||||||
|
suffixIcon: ColorFiltered(
|
||||||
|
colorFilter: ColorFilter.mode(
|
||||||
|
Theme.of(context).colorScheme.primary.withOpacity(0.8),
|
||||||
|
BlendMode.srcIn,
|
||||||
),
|
),
|
||||||
border: const OutlineInputBorder(),
|
child: InkWell(
|
||||||
suffixIcon: ColorFiltered(
|
borderRadius: BorderRadius.circular(50),
|
||||||
colorFilter: ColorFilter.mode(
|
onTap: () {
|
||||||
Theme.of(context).colorScheme.primary.withOpacity(0.8),
|
isPasswordVisible.value = !isPasswordVisible.value;
|
||||||
BlendMode.srcIn,
|
},
|
||||||
),
|
child: Container(
|
||||||
child: InkWell(
|
margin: const EdgeInsets.only(left: 8, right: 8),
|
||||||
borderRadius: BorderRadius.circular(50),
|
child: Lottie.asset(
|
||||||
onTap: () {
|
'assets/animations/Animation - 1714930099660.json',
|
||||||
isPasswordVisible.value = !isPasswordVisible.value;
|
controller: isPasswordVisibleAnimationController,
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
margin: const EdgeInsets.only(left: 8, right: 8),
|
|
||||||
child: Lottie.asset(
|
|
||||||
'assets/animations/Animation - 1714930099660.json',
|
|
||||||
controller: isPasswordVisibleAnimationController,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
suffixIconConstraints: const BoxConstraints(
|
),
|
||||||
maxHeight: 45,
|
suffixIconConstraints: const BoxConstraints(
|
||||||
),
|
maxHeight: 45,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 30),
|
),
|
||||||
ElevatedButton(
|
const SizedBox(height: 30),
|
||||||
onPressed: loginAndSave,
|
ElevatedButton(
|
||||||
child: const Text('Login'),
|
onPressed: loginAndSave,
|
||||||
),
|
child: const Text('Login'),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
2
shelfsdk
2
shelfsdk
|
|
@ -1 +1 @@
|
||||||
Subproject commit ac8e94df7b28c4334165a11c3b445cd0cc497495
|
Subproject commit 5cc545ca87c05615473ab9c363cfa29e341d1e2a
|
||||||
Loading…
Add table
Add a link
Reference in a new issue