-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚀 ⚡ Added Dark and Light Theme Modes, Fixed #3!
- Loading branch information
Showing
15 changed files
with
201 additions
and
111 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
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,42 @@ | ||
import 'package:chat_desk/core/io/app_manager.dart'; | ||
import 'package:chat_desk/io/app_style.dart'; | ||
import 'package:chat_desk/ui/utils.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class AppStyleSwitcher extends StatelessWidget { | ||
const AppStyleSwitcher({super.key}); | ||
|
||
Icon _getIcon() { | ||
if (currentStyleMode == AppStyle.dark) { | ||
return const Icon( | ||
Icons.nights_stay_rounded, | ||
color: Colors.deepPurple, | ||
); | ||
} | ||
return Icon( | ||
Icons.sunny, | ||
color: Colors.yellow.shade900, | ||
); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return AppUtils.buildTooltip( | ||
text: "Requires App Restart", | ||
child: IconButton( | ||
onPressed: () async { | ||
AppStyleManager.switchStyle(currentStyleMode == AppStyle.light | ||
? AppStyle.dark | ||
: AppStyle.light); | ||
await AppManager.preferences | ||
.setString("style-mode", currentStyleMode); | ||
}, | ||
icon: _getIcon(), | ||
iconSize: 48, | ||
splashRadius: 35, | ||
highlightColor: Colors.grey.withOpacity(0.1), | ||
splashColor: Colors.white.withOpacity(0.1), | ||
), | ||
); | ||
} | ||
} |
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
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
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
Oops, something went wrong.