Open greatsam4sure opened 3 years ago
i have also same issue and then i found solution to make my own maximize/restore, minimize, close icon button and moveable Title Bar here is my maximize/ restore button
class MaxMinButton extends StatefulWidget {
const MaxMinButton({Key? key}) : super(key: key);
@override
_MaxMinButtonState createState() => _MaxMinButtonState();
}
class _MaxMinButtonState extends State<MaxMinButton> {
@override
void initState() {
super.initState();
Timer.periodic(Duration(milliseconds: 10), (Timer timer) {
setState(() {});
});
}
bool isMax() => appWindow.isMaximized;
@override
Widget build(BuildContext context) {
return ElevatedButton(
style: ButtonStyle(
elevation: MaterialStateProperty.all(0),
backgroundColor: MaterialStateProperty.resolveWith<Color>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.hovered)) {
return Colors.grey.shade400;
}
return Colors.transparent;
}),
),
onPressed: () {
appWindow.maximizeOrRestore();
},
child: Icon(
isMax() ? Icons.close_fullscreen : Icons.open_in_full,
color: Colors.white,
),
);
}
}
you can be change icon as you went
on windows a typical window shows maximize icon when window is not maximize but after maximizing the window the icon changes to restore icon. Currently your package is using only maximize icon for both maximize and restore. It will be nice to change the maximize icon to restore icon after a the window is maximize. Thanks for this beautiful package