added fading scroll; widget refactorings
This commit is contained in:
@@ -1,17 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:flutter_material_design_icons/flutter_material_design_icons.dart';
|
||||
import 'package:lensai/features/web_view/domain/entities/web_view_page.dart';
|
||||
import 'package:lensai/features/web_view/presentation/widgets/favicon.dart';
|
||||
import 'package:lensai/features/web_view/presentation/widgets/web_view.dart';
|
||||
import 'package:text_scroll/text_scroll.dart';
|
||||
|
||||
class AppBarTitle extends HookWidget {
|
||||
final WebView activeWebView;
|
||||
class AppBarTitle extends StatelessWidget {
|
||||
final WebViewPage page;
|
||||
|
||||
final void Function()? onTap;
|
||||
|
||||
const AppBarTitle({required this.activeWebView, this.onTap, super.key});
|
||||
const AppBarTitle({required this.page, this.onTap, super.key});
|
||||
|
||||
Icon _securityStatusIcon(BuildContext context, WebViewPage page) {
|
||||
if (page.url.isScheme('http')) {
|
||||
@@ -36,8 +34,6 @@ class AppBarTitle extends HookWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final page = useValueListenable(activeWebView.page);
|
||||
|
||||
final theme = Theme.of(context);
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:fading_scroll/fading_scroll.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart' show rootBundle;
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
@@ -22,115 +23,127 @@ class LandingContent extends HookConsumerWidget {
|
||||
() async => rootBundle.loadString('assets/landing/changelog.md'),
|
||||
);
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'Lensai',
|
||||
style: textTheme.titleLarge?.copyWith(fontWeight: FontWeight.bold),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
Text(
|
||||
'The Privacy-Focused & AI-Powered Research Browser with Kagi integration',
|
||||
style: textTheme.titleMedium,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
FractionallySizedBox(
|
||||
widthFactor: 0.5,
|
||||
child: Image.asset('assets/icon/icon.png'),
|
||||
),
|
||||
const LandingAction(),
|
||||
Consumer(
|
||||
builder: (context, ref, child) {
|
||||
final errors = ref.watch(
|
||||
appInitializationServiceProvider
|
||||
.select((result) => result.valueOrNull?.errors),
|
||||
);
|
||||
return FadingScroll(
|
||||
fadingSize: 25,
|
||||
builder: (context, controller) {
|
||||
return SingleChildScrollView(
|
||||
controller: controller,
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'Lensai',
|
||||
style:
|
||||
textTheme.titleLarge?.copyWith(fontWeight: FontWeight.bold),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: Text(
|
||||
'The Privacy-Focused & AI-Powered Research Browser with Kagi integration',
|
||||
style: textTheme.titleMedium,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
FractionallySizedBox(
|
||||
widthFactor: 0.5,
|
||||
child: Image.asset('assets/icon/icon.png'),
|
||||
),
|
||||
const LandingAction(),
|
||||
Consumer(
|
||||
builder: (context, ref, child) {
|
||||
final errors = ref.watch(
|
||||
appInitializationServiceProvider
|
||||
.select((result) => result.valueOrNull?.errors),
|
||||
);
|
||||
|
||||
if (errors == null || errors.isEmpty) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
if (errors == null || errors.isEmpty) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
...errors.map(
|
||||
(error) {
|
||||
final theme = Theme.of(context);
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: ErrorContainer(
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Error during App Initialization!',
|
||||
style: theme.textTheme.titleMedium,
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
...errors.map(
|
||||
(error) {
|
||||
final theme = Theme.of(context);
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: ErrorContainer(
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Error during App Initialization!',
|
||||
style: theme.textTheme.titleMedium,
|
||||
),
|
||||
Text(
|
||||
error.message,
|
||||
style: theme.textTheme.titleSmall,
|
||||
),
|
||||
if (error.details != null)
|
||||
Text(error.details.toString()),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
error.message,
|
||||
style: theme.textTheme.titleSmall,
|
||||
),
|
||||
if (error.details != null)
|
||||
Text(error.details.toString()),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: FilledButton.tonalIcon(
|
||||
onPressed: () async {
|
||||
await ref
|
||||
.read(
|
||||
appInitializationServiceProvider.notifier)
|
||||
.reinitialize();
|
||||
},
|
||||
style: OutlinedButton.styleFrom(
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
),
|
||||
label: const Text('Restart App'),
|
||||
icon: const Icon(Icons.refresh_outlined),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: FilledButton.tonalIcon(
|
||||
onPressed: () async {
|
||||
await ref
|
||||
.read(appInitializationServiceProvider.notifier)
|
||||
.reinitialize();
|
||||
},
|
||||
style: OutlinedButton.styleFrom(
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
),
|
||||
label: const Text('Restart App'),
|
||||
icon: const Icon(Icons.refresh_outlined),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
Markdown(
|
||||
data: descriptionAsset.data ?? '',
|
||||
onTapLink: (text, href, title) async {
|
||||
if (href != null) {
|
||||
await ref
|
||||
.read(switchNewTabControllerProvider.notifier)
|
||||
.add(Uri.parse(href));
|
||||
}
|
||||
},
|
||||
selectable: true,
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
),
|
||||
Text(
|
||||
'Changelog',
|
||||
style:
|
||||
textTheme.titleLarge?.copyWith(fontWeight: FontWeight.bold),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
Markdown(
|
||||
data: changelogAsset.data ?? '',
|
||||
selectable: true,
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
),
|
||||
],
|
||||
),
|
||||
Markdown(
|
||||
data: descriptionAsset.data ?? '',
|
||||
onTapLink: (text, href, title) async {
|
||||
if (href != null) {
|
||||
await ref
|
||||
.read(switchNewTabControllerProvider.notifier)
|
||||
.add(Uri.parse(href));
|
||||
}
|
||||
},
|
||||
selectable: true,
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
),
|
||||
Text(
|
||||
'Changelog',
|
||||
style: textTheme.titleLarge?.copyWith(fontWeight: FontWeight.bold),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
Markdown(
|
||||
data: changelogAsset.data ?? '',
|
||||
selectable: true,
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user