-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add `toggle switch` to customized app bar - add `FluentAppBarButton` class BREAKING-CHANGE: toggle switch code is commented cause of interupting with material & fluent in Theme class in changing theme action. once theme migrate to fluent version it can be uncommented.
- Loading branch information
1 parent
2451ab5
commit 67581a5
Showing
2 changed files
with
55 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import 'package:fluent_ui/fluent_ui.dart'; | ||
import 'package:flutter_svg/svg.dart'; | ||
|
||
class FluentAppBarButton extends StatelessWidget { | ||
const FluentAppBarButton({ | ||
super.key, | ||
required this.icon, | ||
required this.onPressed, | ||
}); | ||
|
||
final String icon; | ||
final VoidCallback onPressed; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Padding( | ||
padding: const EdgeInsets.symmetric(horizontal: 4), | ||
child: HoverButton( | ||
onPressed: onPressed, | ||
builder: (context, states) { | ||
final color = states.isHovered | ||
? Colors.red | ||
: Colors.transparent; | ||
return Container( | ||
height: 48, | ||
width: 48, | ||
decoration: BoxDecoration( | ||
color: color, | ||
borderRadius: BorderRadius.circular(4), | ||
), | ||
child: SvgPicture.asset(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