-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: compact search bar for genres and user_local_tracks page
- Loading branch information
Showing
3 changed files
with
59 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_hooks/flutter_hooks.dart'; | ||
import 'package:platform_ui/platform_ui.dart'; | ||
import 'package:popover/popover.dart'; | ||
|
||
class CompactSearch extends HookWidget { | ||
final ValueChanged<String>? onChanged; | ||
final String placeholder; | ||
final IconData icon; | ||
|
||
const CompactSearch({ | ||
Key? key, | ||
this.onChanged, | ||
this.placeholder = "Search...", | ||
this.icon = Icons.search, | ||
}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return PlatformIconButton( | ||
onPressed: () { | ||
showPopover( | ||
context: context, | ||
backgroundColor: PlatformTheme.of(context).secondaryBackgroundColor!, | ||
transitionDuration: const Duration(milliseconds: 100), | ||
barrierColor: Colors.transparent, | ||
bodyBuilder: (context) { | ||
return Padding( | ||
padding: const EdgeInsets.all(8.0), | ||
child: PlatformTextField( | ||
autofocus: true, | ||
onChanged: onChanged, | ||
placeholder: placeholder, | ||
prefixIcon: icon, | ||
), | ||
); | ||
}, | ||
height: 60, | ||
); | ||
}, | ||
tooltip: placeholder, | ||
icon: Icon(icon), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters