fix filter

This commit is contained in:
kodjodevf 2023-04-28 09:40:56 +01:00
parent 667681caa8
commit 625c176f40
7 changed files with 470 additions and 324 deletions

View file

@ -40,7 +40,7 @@ void main() async {
await Hive.openBox(HiveConstant.hiveBoxMangaInfo);
await Hive.openBox(HiveConstant.hiveBoxMangaFilter);
await Hive.openBox(HiveConstant.hiveBoxAppSettings);
await Hive.openBox(HiveConstant.hiveBoxCategories);
await Hive.openBox<CategoriesModel>(HiveConstant.hiveBoxCategories);
runApp(const ProviderScope(child: MyApp()));
}

View file

@ -165,7 +165,9 @@ class MangaFilterUnreadState extends _$MangaFilterUnreadState {
}
int getType() {
return ref.watch(hiveBoxSettingsProvider).get("filterMangaUnread", defaultValue: 0);
return ref
.watch(hiveBoxSettingsProvider)
.get("filterMangaUnread", defaultValue: 0);
}
void setType(int type) {
@ -242,11 +244,13 @@ class MangaFilterStartedState extends _$MangaFilterStartedState {
}
int getType() {
return ref.watch(hiveBoxSettingsProvider).get("filterMangaStated", defaultValue: 0);
return ref
.watch(hiveBoxSettingsProvider)
.get("filterMangaStarted", defaultValue: 0);
}
void setType(int type) {
ref.watch(hiveBoxSettingsProvider).put("filterMangaStated", type);
ref.watch(hiveBoxSettingsProvider).put("filterMangaStarted", type);
state = type;
}
@ -412,18 +416,14 @@ class MangaFilterResultState extends _$MangaFilterResultState {
}
bool isNotFiltering() {
final downloadFilterType = ref
.read(mangaFilterDownloadedStateProvider(mangaList: mangaList).notifier)
.getType();
final unreadFilterType = ref
.read(mangaFilterUnreadStateProvider(mangaList: mangaList).notifier)
.getType();
final startedFilterType = ref
.read(mangaFilterStartedStateProvider(mangaList: mangaList).notifier)
.getType();
final bookmarkedFilterType = ref
.read(mangaFilterBookmarkedStateProvider(mangaList: mangaList).notifier)
.getType();
final downloadFilterType =
ref.watch(mangaFilterDownloadedStateProvider(mangaList: mangaList));
final unreadFilterType =
ref.watch(mangaFilterUnreadStateProvider(mangaList: mangaList));
final startedFilterType =
ref.watch(mangaFilterStartedStateProvider(mangaList: mangaList));
final bookmarkedFilterType =
ref.watch(mangaFilterBookmarkedStateProvider(mangaList: mangaList));
return downloadFilterType == 0 &&
unreadFilterType == 0 &&
startedFilterType == 0 &&

View file

@ -73,15 +73,10 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
.chapters!
.length +
1;
final chapterNameList = ref.watch(chapterNameListStateProvider);
final isLongPressed = ref.watch(isLongPressedStateProvider);
final reverse =
ref.watch(reverseMangaStateProvider(modelManga: widget.modelManga!));
final chapter = ref.watch(chapterModelStateProvider);
final isNotFiltering = ref
.read(chapterFilterResultStateProvider(modelManga: widget.modelManga!)
.notifier)
.isNotFiltering();
return NotificationListener<UserScrollNotification>(
onNotification: (notification) {
if (notification.direction == ScrollDirection.forward) {
@ -93,274 +88,308 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
return true;
},
child: Scaffold(
extendBodyBehindAppBar: true,
appBar: PreferredSize(
preferredSize: Size.fromHeight(AppBar().preferredSize.height),
child: isLongPressed
? Container(
color: Theme.of(context).scaffoldBackgroundColor,
child: AppBar(
title: Text(chapterNameList.length.toString()),
backgroundColor: generalColor(context).withOpacity(0.2),
leading: IconButton(
onPressed: () {
ref
.read(chapterNameListStateProvider.notifier)
.clear();
extendBodyBehindAppBar: true,
appBar: PreferredSize(
preferredSize: Size.fromHeight(AppBar().preferredSize.height),
child: Consumer(
builder: (context, ref, child) {
final isNotFiltering = ref
.read(chapterFilterResultStateProvider(
modelManga: widget.modelManga!)
.notifier)
.isNotFiltering();
final isLongPressed = ref.watch(isLongPressedStateProvider);
final chapterNameList =
ref.watch(chapterNameListStateProvider);
return isLongPressed
? Container(
color: Theme.of(context).scaffoldBackgroundColor,
child: AppBar(
title: Text(chapterNameList.length.toString()),
backgroundColor:
generalColor(context).withOpacity(0.2),
leading: IconButton(
onPressed: () {
ref
.read(chapterNameListStateProvider
.notifier)
.clear();
ref
.read(isLongPressedStateProvider.notifier)
.update(!isLongPressed);
},
icon: const Icon(Icons.clear)),
actions: [
IconButton(
onPressed: () {
for (var i = 0;
i < widget.modelManga!.chapters!.length;
i++) {
ref
.read(
chapterNameListStateProvider.notifier)
.selectAll(widget
.modelManga!.chapters![i].name!);
}
},
icon: const Icon(Icons.select_all)),
IconButton(
onPressed: () {
if (widget.modelManga!.chapters!.length ==
chapterNameList.length) {
for (var i = 0;
i < widget.modelManga!.chapters!.length;
i++) {
ref
.read(chapterNameListStateProvider
.notifier)
.selectSome(widget
.modelManga!.chapters![i].name!);
}
ref
.read(isLongPressedStateProvider.notifier)
.update(false);
} else {
for (var i = 0;
i < widget.modelManga!.chapters!.length;
i++) {
ref
.read(chapterNameListStateProvider
.notifier)
.selectSome(widget
.modelManga!.chapters![i].name!);
}
}
},
icon: const Icon(Icons.flip_to_back_rounded)),
],
),
)
: AppBar(
title: ref.watch(offetProvider) > 200
? Text(
widget.modelManga!.name!,
style: const TextStyle(fontSize: 17),
)
: null,
backgroundColor: ref.watch(offetProvider) == 0.0
? Colors.transparent
: Theme.of(context).scaffoldBackgroundColor,
actions: [
IconButton(
splashRadius: 20,
onPressed: () {},
icon: const Icon(
Icons.download_outlined,
)),
IconButton(
splashRadius: 20,
onPressed: () {
_showDraggableMenu();
},
icon: Icon(
Icons.filter_list_sharp,
color: isNotFiltering ? null : Colors.yellow,
)),
PopupMenuButton(
itemBuilder: (context) {
return [
const PopupMenuItem<int>(
value: 0, child: Text("Edit categories")),
const PopupMenuItem<int>(
value: 0, child: Text("Migrate")),
const PopupMenuItem<int>(
value: 0, child: Text("Share")),
];
},
onSelected: (value) {}),
.read(
isLongPressedStateProvider.notifier)
.update(!isLongPressed);
},
icon: const Icon(Icons.clear)),
actions: [
IconButton(
onPressed: () {
for (var i = 0;
i <
widget
.modelManga!.chapters!.length;
i++) {
ref
.read(chapterNameListStateProvider
.notifier)
.selectAll(widget.modelManga!
.chapters![i].name!);
}
},
icon: const Icon(Icons.select_all)),
IconButton(
onPressed: () {
if (widget.modelManga!.chapters!.length ==
chapterNameList.length) {
for (var i = 0;
i <
widget.modelManga!.chapters!
.length;
i++) {
ref
.read(chapterNameListStateProvider
.notifier)
.selectSome(widget.modelManga!
.chapters![i].name!);
}
ref
.read(isLongPressedStateProvider
.notifier)
.update(false);
} else {
for (var i = 0;
i <
widget.modelManga!.chapters!
.length;
i++) {
ref
.read(chapterNameListStateProvider
.notifier)
.selectSome(widget.modelManga!
.chapters![i].name!);
}
}
},
icon:
const Icon(Icons.flip_to_back_rounded)),
],
),
)
: AppBar(
title: ref.watch(offetProvider) > 200
? Text(
widget.modelManga!.name!,
style: const TextStyle(fontSize: 17),
)
: null,
backgroundColor: ref.watch(offetProvider) == 0.0
? Colors.transparent
: Theme.of(context).scaffoldBackgroundColor,
actions: [
IconButton(
splashRadius: 20,
onPressed: () {},
icon: const Icon(
Icons.download_outlined,
)),
IconButton(
splashRadius: 20,
onPressed: () {
_showDraggableMenu();
},
icon: Icon(
Icons.filter_list_sharp,
color:
isNotFiltering ? null : Colors.yellow,
)),
PopupMenuButton(
itemBuilder: (context) {
return [
const PopupMenuItem<int>(
value: 0,
child: Text("Edit categories")),
const PopupMenuItem<int>(
value: 0, child: Text("Migrate")),
const PopupMenuItem<int>(
value: 0, child: Text("Share")),
];
},
onSelected: (value) {}),
],
);
},
)),
body: Stack(
children: [
Positioned(
top: 0,
child: Stack(
children: [
cachedNetworkImage(
imageUrl: widget.modelManga!.imageUrl!,
width: mediaWidth(context, 1),
height: 461,
fit: BoxFit.cover),
Container(
width: mediaWidth(context, 1),
height: 465,
color: Theme.of(context)
.scaffoldBackgroundColor
.withOpacity(0.9),
),
SafeArea(
child: Container(
width: mediaWidth(context, 1),
height: mediaHeight(context, 1),
color: Theme.of(context).scaffoldBackgroundColor),
)
],
)),
body: Stack(
children: [
Positioned(
top: 0,
child: Stack(
children: [
cachedNetworkImage(
imageUrl: widget.modelManga!.imageUrl!,
width: mediaWidth(context, 1),
height: 461,
fit: BoxFit.cover),
Container(
width: mediaWidth(context, 1),
height: 465,
color: Theme.of(context)
.scaffoldBackgroundColor
.withOpacity(0.9),
),
SafeArea(
child: Container(
width: mediaWidth(context, 1),
height: mediaHeight(context, 1),
color: Theme.of(context).scaffoldBackgroundColor),
)
],
)),
SafeArea(
child: DraggableScrollbar(
heightScrollThumb: 48.0,
backgroundColor: generalColor(context),
scrollThumbBuilder: (backgroundColor, thumbAnimation,
labelAnimation, height,
{labelConstraints, labelText}) {
return FadeTransition(
opacity: thumbAnimation,
child: Container(
decoration: BoxDecoration(
color: backgroundColor,
borderRadius: BorderRadius.circular(20)),
height: height,
width: 8.0,
),
);
},
scrollbarTimeToFade: const Duration(seconds: 2),
controller: _scrollController,
child: ListView.builder(
controller: _scrollController,
padding: const EdgeInsets.only(top: 0, bottom: 60),
itemCount: _pageLength,
itemBuilder: (context, index) {
int finalIndex = index - 1;
if (index == 0) {
return _bodyContainer();
}
int reverseIndex = _chapters!.length -
_chapters!.reversed.toList().indexOf(
_chapters!.reversed.toList()[finalIndex]) -
1;
SafeArea(
child: DraggableScrollbar(
heightScrollThumb: 48.0,
backgroundColor: generalColor(context),
scrollThumbBuilder: (backgroundColor, thumbAnimation,
labelAnimation, height,
{labelConstraints, labelText}) {
return FadeTransition(
opacity: thumbAnimation,
child: Container(
decoration: BoxDecoration(
color: backgroundColor,
borderRadius: BorderRadius.circular(20)),
height: height,
width: 8.0,
),
);
},
scrollbarTimeToFade: const Duration(seconds: 2),
controller: _scrollController,
child: ListView.builder(
controller: _scrollController,
padding: const EdgeInsets.only(top: 0, bottom: 60),
itemCount: _pageLength,
itemBuilder: (context, index) {
int finalIndex = index - 1;
if (index == 0) {
return _bodyContainer();
}
int reverseIndex = _chapters!.length -
_chapters!.reversed.toList().indexOf(
_chapters!.reversed
.toList()[finalIndex]) -
1;
List<ModelChapters> chapters = reverse
? _chapters!.reversed.toList()
: _chapters!;
List<ModelChapters> chapters = reverse
? _chapters!.reversed.toList()
: _chapters!;
return ChapterListTileWidget(
return ChapterListTileWidget(
chapters: chapters,
modelManga: _modelManga!,
reverse: reverse,
reverseIndex: reverseIndex,
finalIndex: finalIndex,
isLongPressed: isLongPressed);
}))),
],
),
bottomNavigationBar: AnimatedContainer(
curve: Curves.easeIn,
decoration: BoxDecoration(
color: generalColor(context).withOpacity(0.2),
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20))),
duration: const Duration(milliseconds: 100),
height: isLongPressed ? 70 : 0,
width: mediaWidth(context, 1),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Expanded(
child: SizedBox(
height: 70,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 0, backgroundColor: Colors.transparent),
onPressed: () async {
ref
.read(chapterSetIsBookmarkStateProvider(
modelManga: widget.modelManga!)
.notifier)
.set();
ref
.read(chapterNameListStateProvider.notifier)
.clear();
ref
.read(isLongPressedStateProvider.notifier)
.update(false);
},
child: Icon(chapter.isBookmarked
? Icons.bookmark_remove
: Icons.bookmark_add_outlined)),
),
),
Expanded(
child: SizedBox(
height: 70,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 0, backgroundColor: Colors.transparent),
onPressed: () {
ref
.read(chapterSetIsReadStateProvider(
modelManga: widget.modelManga!)
.notifier)
.set();
ref
.read(chapterNameListStateProvider.notifier)
.clear();
ref
.read(isLongPressedStateProvider.notifier)
.update(false);
},
child: Icon(chapter.isRead
? Icons.remove_done_sharp
: Icons.done_all_sharp)),
),
),
Expanded(
child: SizedBox(
height: 70,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 0, backgroundColor: Colors.transparent),
onPressed: () {
ref
.read(chapterSetDownloadStateProvider(
modelManga: widget.modelManga!)
.notifier)
.set();
ref
.read(isLongPressedStateProvider.notifier)
.update(false);
ref
.read(chapterNameListStateProvider.notifier)
.clear();
},
child: const Icon(Icons.download_outlined)),
),
)
);
}))),
],
),
),
));
bottomNavigationBar: Consumer(
builder: (context, ref, child) {
final chapter = ref.watch(chapterModelStateProvider);
final isLongPressed = ref.watch(isLongPressedStateProvider);
return AnimatedContainer(
curve: Curves.easeIn,
decoration: BoxDecoration(
color: generalColor(context).withOpacity(0.2),
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20))),
duration: const Duration(milliseconds: 100),
height: isLongPressed ? 70 : 0,
width: mediaWidth(context, 1),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Expanded(
child: SizedBox(
height: 70,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 0,
backgroundColor: Colors.transparent),
onPressed: () async {
ref
.read(chapterSetIsBookmarkStateProvider(
modelManga: widget.modelManga!)
.notifier)
.set();
ref
.read(chapterNameListStateProvider.notifier)
.clear();
ref
.read(isLongPressedStateProvider.notifier)
.update(false);
},
child: Icon(chapter.isBookmarked
? Icons.bookmark_remove
: Icons.bookmark_add_outlined)),
),
),
Expanded(
child: SizedBox(
height: 70,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 0,
backgroundColor: Colors.transparent),
onPressed: () {
ref
.read(chapterSetIsReadStateProvider(
modelManga: widget.modelManga!)
.notifier)
.set();
ref
.read(chapterNameListStateProvider.notifier)
.clear();
ref
.read(isLongPressedStateProvider.notifier)
.update(false);
},
child: Icon(chapter.isRead
? Icons.remove_done_sharp
: Icons.done_all_sharp)),
),
),
Expanded(
child: SizedBox(
height: 70,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 0,
backgroundColor: Colors.transparent),
onPressed: () {
ref
.read(chapterSetDownloadStateProvider(
modelManga: widget.modelManga!)
.notifier)
.set();
ref
.read(isLongPressedStateProvider.notifier)
.update(false);
ref
.read(chapterNameListStateProvider.notifier)
.clear();
},
child: const Icon(Icons.download_outlined)),
),
)
],
),
);
},
)));
}
_showDraggableMenu() {

View file

@ -58,7 +58,8 @@ class _MangaDetailsViewState extends ConsumerState<MangaDetailsView> {
? null
: widget.modelManga.chapters!.isNotEmpty
? ValueListenableBuilder<Box>(
valueListenable: ref.watch(hiveBoxMangaInfoProvider).listenable(),
valueListenable:
ref.watch(hiveBoxMangaInfoProvider).listenable(),
builder: (context, value, child) {
final entries = value.get(
"${widget.modelManga.lang}-${widget.modelManga.source}/${widget.modelManga.name}-chapter_index",
@ -227,8 +228,25 @@ class _MangaDetailsViewState extends ConsumerState<MangaDetailsView> {
elevation: 0),
onPressed: () {
_setFavorite(false);
manga.delete(
'${widget.modelManga.lang}-${widget.modelManga.link}');
final model = ModelManga(
imageUrl: widget.modelManga.imageUrl,
name: widget.modelManga.name,
genre: widget.modelManga.genre,
author: widget.modelManga.author,
status: widget.modelManga.status,
description: widget.modelManga.description,
favorite: false,
link: widget.modelManga.link,
source: widget.modelManga.source,
lang: widget.modelManga.lang,
dateAdded: widget.modelManga.dateAdded,
lastUpdate: widget.modelManga.lastUpdate,
chapters: widget.modelManga.chapters,
category: widget.modelManga.category,
lastRead: widget.modelManga.lastRead);
manga.put(
'${widget.modelManga.lang}-${widget.modelManga.link}',
model);
},
child: Column(
children: const [

View file

@ -473,18 +473,13 @@ class ChapterFilterResultState extends _$ChapterFilterResultState {
}
bool isNotFiltering() {
final downloadFilterType = ref
.read(chapterFilterDownloadedStateProvider(modelManga: modelManga)
.notifier)
.getType();
final unreadFilterType = ref
.read(chapterFilterUnreadStateProvider(modelManga: modelManga).notifier)
.getType();
final downloadFilterType =
ref.watch(chapterFilterDownloadedStateProvider(modelManga: modelManga));
final unreadFilterType =
ref.watch(chapterFilterUnreadStateProvider(modelManga: modelManga));
final bookmarkedFilterType = ref
.read(chapterFilterBookmarkedStateProvider(modelManga: modelManga)
.notifier)
.getType();
final bookmarkedFilterType =
ref.watch(chapterFilterBookmarkedStateProvider(modelManga: modelManga));
return downloadFilterType == 0 &&
unreadFilterType == 0 &&
bookmarkedFilterType == 0;
@ -517,19 +512,14 @@ class ChapterSetIsBookmarkState extends _$ChapterSetIsBookmarkState {
build({required ModelManga modelManga}) {}
set() {
final entries = ref
.watch(hiveBoxMangaProvider)
.get('${modelManga.lang}-${modelManga.link}', defaultValue: modelManga);
for (var name in ref.watch(chapterNameListStateProvider)) {
List<ModelChapters> chap = [];
for (var i = 0; i < modelManga.chapters!.length; i++) {
final entries = ref
.watch(hiveBoxMangaProvider)
.values
.where((element) =>
'${element.lang}-${element.link}' ==
'${modelManga.lang}-${modelManga.link}')
.toList()
.first;
chap.add(ModelChapters(
name: entries.chapters![i].name,
name: entries!.chapters![i].name,
url: entries.chapters![i].url,
dateUpload: entries.chapters![i].dateUpload,
isBookmarked: name == entries.chapters![i].name
@ -556,19 +546,14 @@ class ChapterSetIsReadState extends _$ChapterSetIsReadState {
build({required ModelManga modelManga}) {}
set() {
final entries = ref
.watch(hiveBoxMangaProvider)
.get('${modelManga.lang}-${modelManga.link}', defaultValue: modelManga);
for (var name in ref.watch(chapterNameListStateProvider)) {
List<ModelChapters> chap = [];
for (var i = 0; i < modelManga.chapters!.length; i++) {
final entries = ref
.watch(hiveBoxMangaProvider)
.values
.where((element) =>
'${element.lang}-${element.link}' ==
'${modelManga.lang}-${modelManga.link}')
.toList()
.first;
chap.add(ModelChapters(
name: entries.chapters![i].name,
name: entries!.chapters![i].name,
url: entries.chapters![i].url,
dateUpload: entries.chapters![i].dateUpload,
isBookmarked: entries.chapters![i].isBookmarked,

View file

@ -13,18 +13,19 @@ class ChapterListTileWidget extends ConsumerWidget {
final bool reverse;
final int reverseIndex;
final int finalIndex;
final bool isLongPressed;
const ChapterListTileWidget(
{super.key,
required this.chapters,
required this.modelManga,
required this.reverse,
required this.reverseIndex,
required this.finalIndex,
required this.isLongPressed});
const ChapterListTileWidget({
super.key,
required this.chapters,
required this.modelManga,
required this.reverse,
required this.reverseIndex,
required this.finalIndex,
});
@override
Widget build(BuildContext context, WidgetRef ref) {
final isLongPressed = ref.watch(isLongPressedStateProvider);
final idx = reverse ? reverseIndex : finalIndex;
final chapterNameList = ref.watch(chapterNameListStateProvider);
final chapterName = modelManga.chapters![idx].name;

View file

@ -1,11 +1,124 @@
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/src/widgets/placeholder.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:mangayomi/models/categories.dart';
import 'package:mangayomi/providers/hive_provider.dart';
class CategoriesScreen extends StatelessWidget {
class CategoriesScreen extends ConsumerStatefulWidget {
const CategoriesScreen({super.key});
@override
ConsumerState<CategoriesScreen> createState() => _CategoriesScreenState();
}
class _CategoriesScreenState extends ConsumerState<CategoriesScreen> {
@override
Widget build(BuildContext context) {
return const Placeholder();
return Scaffold(
appBar: AppBar(
title: const Text("Edit categories"),
),
body: ValueListenableBuilder<Box<CategoriesModel>>(
valueListenable: ref.watch(hiveBoxCategoriesProvider).listenable(),
builder: (context, value, child) {
final entries = value.values.toList();
if (entries.isNotEmpty) {
return ListView.builder(
itemBuilder: (context, index) {},
);
} else {
return const Center(
child: Padding(
padding: EdgeInsets.all(8.0),
child: Text(
"You have no categories. Tap the plus button to create one for organizing your library",
textAlign: TextAlign.center,
),
),
);
}
}),
floatingActionButton: FloatingActionButton.extended(
onPressed: () {
showDialog(
context: context,
builder: (context) {
final controller = TextEditingController();
return StatefulBuilder(
builder: (context, setState) {
return AlertDialog(
title: const Text(
"Add category",
),
content: TextFormField(
autofocus: true,
controller: controller,
keyboardType: TextInputType.text,
onChanged: (s) {
setState(() {});
},
onFieldSubmitted: (s) {
setState(() {});
},
decoration: InputDecoration(
isDense: true,
labelText: "Name",
filled: true,
fillColor: Colors.transparent,
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).primaryColor)),
border: OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).primaryColor))),
),
actions: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
onPressed: () {
Navigator.pop(context);
},
child: const Text("Cancel")),
const SizedBox(
width: 15,
),
TextButton(
onPressed: controller.text.isEmpty
? null
: () {
Navigator.pop(context);
},
child: Text(
"Add",
style: TextStyle(
color: controller.text.isEmpty
? Theme.of(context)
.primaryColor
.withOpacity(0.2)
: null),
)),
],
)
],
);
},
);
});
},
label: Row(
children: const [
Icon(Icons.add),
SizedBox(
width: 10,
),
Text("Add")
],
)),
);
}
}
}