-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,35 @@ | ||
import 'package:mercurius/index.dart'; | ||
import 'package:riverpod_annotation/riverpod_annotation.dart'; | ||
part 'diary_search_text.g.dart'; | ||
|
||
@riverpod | ||
class DiarySearchText extends _$DiarySearchText { | ||
@override | ||
String build() => '\\n'; | ||
DiarySearch build() => const DiarySearch(); | ||
|
||
void change([String? newString]) { | ||
newString ??= '\\n'; | ||
state = newString == '' ? '\\n' : newString; | ||
} | ||
void change([DiarySearch? newDiarySearch]) => | ||
state = newDiarySearch ?? const DiarySearch(); | ||
} | ||
|
||
@JsonSerializable() | ||
class DiarySearch { | ||
const DiarySearch({ | ||
this.text = '\\n', | ||
this.searchTitle = false, | ||
}); | ||
final String text; | ||
final bool searchTitle; | ||
|
||
DiarySearch copyWith({ | ||
String? text, | ||
bool? searchTitle, | ||
}) => | ||
DiarySearch( | ||
text: text ?? this.text, | ||
searchTitle: searchTitle ?? this.searchTitle, | ||
); | ||
|
||
factory DiarySearch.fromJson(Map<String, dynamic> json) => | ||
_$DiarySearchFromJson(json); | ||
Map<String, dynamic> toJson() => _$DiarySearchToJson(this); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import 'package:mercurius/index.dart'; | ||
|
||
class BaseChipWidget extends StatelessWidget { | ||
const BaseChipWidget({ | ||
super.key, | ||
required this.label, | ||
this.borderRadius = 8, | ||
this.keepLeadingArea = true, | ||
this.keepTracingArea = false, | ||
this.labelLeadingSpacing = 4, | ||
this.labelTracingSpacing = 4, | ||
this.labelWidth, | ||
this.labelColor, | ||
this.fontWeight, | ||
this.leadingIconData, | ||
this.tracingIconData, | ||
this.leadingIconColor, | ||
this.tracingIconColor, | ||
this.onTap, | ||
}); | ||
|
||
final String label; | ||
final double borderRadius; | ||
final bool keepLeadingArea; | ||
final bool keepTracingArea; | ||
final double labelLeadingSpacing; | ||
final double labelTracingSpacing; | ||
final double? labelWidth; | ||
final Color? labelColor; | ||
final FontWeight? fontWeight; | ||
final IconData? leadingIconData; | ||
final Color? leadingIconColor; | ||
final IconData? tracingIconData; | ||
final Color? tracingIconColor; | ||
final GestureTapCallback? onTap; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final colorScheme = Theme.of(context).colorScheme; | ||
|
||
return Material( | ||
color: Colors.transparent, | ||
child: InkWell( | ||
onTap: onTap, | ||
borderRadius: BorderRadius.circular(borderRadius), | ||
child: Padding( | ||
padding: const EdgeInsets.all(4.0), | ||
child: Wrap( | ||
children: [ | ||
if (keepLeadingArea || leadingIconData != null) | ||
Icon( | ||
leadingIconData, | ||
color: leadingIconColor ?? colorScheme.onSurface, | ||
size: 20, | ||
), | ||
Padding( | ||
padding: EdgeInsets.fromLTRB( | ||
labelLeadingSpacing, | ||
0, | ||
labelTracingSpacing, | ||
0, | ||
), | ||
child: SizedBox( | ||
width: labelWidth, | ||
child: Text( | ||
label, | ||
style: TextStyle( | ||
color: labelColor, | ||
fontWeight: fontWeight, | ||
), | ||
), | ||
), | ||
), | ||
if (keepTracingArea || tracingIconData != null) | ||
Icon( | ||
tracingIconData, | ||
color: tracingIconColor ?? colorScheme.onSurface, | ||
size: 20, | ||
), | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export 'based_chip_widget.dart'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export 'based/index.dart'; | ||
export 'diary/index.dart'; | ||
export 'dialog/index.dart'; | ||
export 'mercurius/index.dart'; |