thememode_selector
라이트 및 다크 테마 모드 사이에서 선택할 수 있는 위젯(개발 중이지만 잘 작동함)
ThemeMode.dark 와 ThemeMode.light 사이에서 선택할 수 있는 위젯
{"sdk":"flutter"}{"sdk":"flutter"}아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
I am currently working with the concept of Theme's in Flutter and I wanted to build a widget which would allow me to switch between light and dark themes. Seeking a design for a simple toggle, I was lucky enough to stumble into some of Zhenya Karapetyan's amazing work on Dribbble. Zhenya's simple yet fun design of a toggle component would look very nice in Flutter, and it has some really cool animations which I wanted to learn.
Zhenya Karapetyan's Light/Dark Toggle
https://dribbble.com/shots/7635203-Light-Dark-mode-toggle-switcher/attachments/396864?mode=media
A widget to toggle between a light or dark ThemeMode
Add thememode_selector: ^0.1.0 to your pubspec.yaml configuration.
import 'package:thememode_selector/thememode_selector.dart'
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(title),
),
body: Center(
child: ThemeModeSelector(
height: 39,
onChanged: (mode) {
print('ThemeMode changed to $mode');
ThemeModeManager.of(context)!.themeMode = mode;
},
),
),
);
}
MIT