Compare commits
10 Commits
306a38a36a
...
v0.1.27
| Author | SHA1 | Date | |
|---|---|---|---|
| 06a76afc42 | |||
| 3032e13dc9 | |||
| d0492b2f79 | |||
| c2506fab7a | |||
| dca8c64555 | |||
| c80606b7d0 | |||
| be6020d6c5 | |||
| 5eb58d7cf2 | |||
| 1aaea5f6d9 | |||
| 3a54a077f3 |
@@ -102,10 +102,16 @@ class _CollectionPageState extends State<CollectionPage> {
|
||||
),
|
||||
],
|
||||
),
|
||||
body: ListView.builder(
|
||||
body: Center(
|
||||
child: SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
child: ListView.separated(
|
||||
itemBuilder: (context, index) =>
|
||||
bookmarksListItemBuilder(context, bookmarks.elementAt(index)),
|
||||
itemCount: bookmarks.length,
|
||||
separatorBuilder: (context, index) => SizedBox(height: 10),
|
||||
),
|
||||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: onAddButtonPressed,
|
||||
|
||||
@@ -21,7 +21,7 @@ class CollectionsListPage extends StatefulWidget {
|
||||
|
||||
class _CollectionsListPageState extends State<CollectionsListPage> {
|
||||
bool addingNewBookmark = false;
|
||||
final bookmarkCountMap = Storage.loadPerCollectionBookmarkCount();
|
||||
var bookmarkCountMap = <int, int>{};
|
||||
|
||||
Widget bottomSheetBuilder(BuildContext context) {
|
||||
final titleTextFieldController = TextEditingController(
|
||||
@@ -84,8 +84,9 @@ class _CollectionsListPageState extends State<CollectionsListPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final collections = Storage.loadCollections();
|
||||
final provider = context.watch<SharedLinkProvider>();
|
||||
addingNewBookmark = provider.currentMapsLinkMetadata != null;
|
||||
bookmarkCountMap = Storage.loadPerCollectionBookmarkCount();
|
||||
addingNewBookmark =
|
||||
context.watch<SharedLinkProvider>().currentMapsLinkMetadata != null;
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: addingNewBookmark
|
||||
@@ -94,7 +95,8 @@ class _CollectionsListPageState extends State<CollectionsListPage> {
|
||||
actions: [
|
||||
if (addingNewBookmark)
|
||||
TextButton(
|
||||
onPressed: () => provider.removeCurrentMapsLink(),
|
||||
onPressed: () =>
|
||||
context.read<SharedLinkProvider>().removeCurrentMapsLink(),
|
||||
child: Text(AppLocalizations.of(context)!.cancel),
|
||||
)
|
||||
else
|
||||
@@ -110,12 +112,18 @@ class _CollectionsListPageState extends State<CollectionsListPage> {
|
||||
child: Icon(Icons.add),
|
||||
),
|
||||
body: collections.isNotEmpty
|
||||
? ListView.builder(
|
||||
? Center(
|
||||
child: SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
child: ListView.separated(
|
||||
itemBuilder: (context, index) => collectionsListItemBuilder(
|
||||
context,
|
||||
collections.elementAt(index),
|
||||
),
|
||||
itemCount: collections.length,
|
||||
separatorBuilder: (context, index) => SizedBox(height: 10),
|
||||
),
|
||||
),
|
||||
)
|
||||
: Center(
|
||||
child: Text(AppLocalizations.of(context)!.tipCreateCollections),
|
||||
|
||||
@@ -14,15 +14,22 @@ class SearchPage extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: Text(AppLocalizations.of(context)!.search)),
|
||||
body: Column(
|
||||
body: Center(
|
||||
child: SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(padding: EdgeInsetsGeometry.only(top: 10)),
|
||||
SearchBarWidget(
|
||||
onEditingComplete: context.read<SearchProvider>().setSearchText,
|
||||
onResetSearch: context.read<SearchProvider>().removeSearchText,
|
||||
),
|
||||
Padding(padding: EdgeInsetsGeometry.only(top: 10)),
|
||||
Expanded(child: SearchResultsWidget()),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,14 +8,32 @@ class Notifying {
|
||||
required String text,
|
||||
bool isError = false,
|
||||
}) {
|
||||
ScaffoldMessenger.of(context).hideCurrentSnackBar();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
backgroundColor: Theme.of(context).colorScheme.error,
|
||||
content: SizedBox(
|
||||
height: 30,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
text,
|
||||
style: isError
|
||||
? TextStyle(color: Theme.of(context).colorScheme.error)
|
||||
? TextStyle(color: Theme.of(context).colorScheme.onError)
|
||||
: null,
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () =>
|
||||
ScaffoldMessenger.of(context).hideCurrentSnackBar(),
|
||||
icon: Icon(
|
||||
Icons.close_rounded,
|
||||
color: Theme.of(context).colorScheme.onError,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,15 +1,26 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
ThemeData get lightTheme => ThemeData.from(colorScheme: _lightColorScheme);
|
||||
const _seed = Colors.deepPurple;
|
||||
|
||||
ThemeData get darkTheme => ThemeData.from(colorScheme: _darkColorScheme);
|
||||
ColorScheme get _lightColorScheme =>
|
||||
ColorScheme.fromSeed(seedColor: _seed, brightness: Brightness.light);
|
||||
|
||||
ColorScheme get _darkColorScheme => ColorScheme.fromSeed(
|
||||
seedColor: Colors.deepPurple,
|
||||
brightness: Brightness.dark,
|
||||
);
|
||||
|
||||
ColorScheme get _lightColorScheme => ColorScheme.fromSeed(
|
||||
seedColor: Colors.deepPurple,
|
||||
brightness: Brightness.light,
|
||||
ColorScheme get _darkColorScheme =>
|
||||
ColorScheme.fromSeed(seedColor: _seed, brightness: Brightness.dark);
|
||||
|
||||
ThemeData get lightTheme => _baseTheme(_lightColorScheme);
|
||||
|
||||
ThemeData get darkTheme => _baseTheme(_darkColorScheme);
|
||||
|
||||
ThemeData _baseTheme(ColorScheme scheme) =>
|
||||
ThemeData.from(colorScheme: scheme, useMaterial3: true).copyWith(
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
|
||||
),
|
||||
listTileTheme: ListTileThemeData(
|
||||
tileColor: scheme.surfaceContainer,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadiusGeometry.circular(12),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -41,9 +41,7 @@ class CreateBookmarkCollectionDialog extends StatelessWidget {
|
||||
FilteringTextInputFormatter.deny(RegExp(r'\s\s+')),
|
||||
],
|
||||
decoration: InputDecoration(
|
||||
// TODO: Localize
|
||||
labelText: AppLocalizations.of(context)!.collectionName,
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(10)),
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
|
||||
@@ -61,9 +61,6 @@ class CreateBookmarkDialog extends StatelessWidget {
|
||||
],
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context)!.bookmarkTitle,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
),
|
||||
TextField(
|
||||
@@ -78,9 +75,6 @@ class CreateBookmarkDialog extends StatelessWidget {
|
||||
],
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context)!.url,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
),
|
||||
TextField(
|
||||
@@ -95,9 +89,6 @@ class CreateBookmarkDialog extends StatelessWidget {
|
||||
],
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context)!.description,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../l10n/app_localizations.dart';
|
||||
|
||||
class SearchBarWidget extends StatelessWidget {
|
||||
const SearchBarWidget({
|
||||
super.key,
|
||||
@@ -28,6 +30,7 @@ class SearchBarWidget extends StatelessWidget {
|
||||
},
|
||||
icon: Icon(Icons.delete_outline_outlined),
|
||||
),
|
||||
labelText: AppLocalizations.of(context)!.search,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -47,9 +47,10 @@ class _SearchResultsWidgetState extends State<SearchResultsWidget> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (filteredBookmarks.isNotEmpty) {
|
||||
return ListView.builder(
|
||||
return ListView.separated(
|
||||
itemBuilder: bookmarkListItemBuilder,
|
||||
itemCount: filteredBookmarks.length,
|
||||
separatorBuilder: (context, index) => SizedBox(height: 10),
|
||||
);
|
||||
}
|
||||
return Center(child: Text(AppLocalizations.of(context)!.tipNoResults));
|
||||
|
||||
Reference in New Issue
Block a user