flutter theme
inspired by panache, a flutter material theme editor for you to configure the overall visual theme of your material app.
usage
flutter theme is developed and built with flutter, and is available for both web and desktop.
disclaimer: i’ve only tested the app on web and macos as i don’t have a windows or linux machine. the app may not work on those platforms.
for web, you can access it through here.
for mac, windows and linux, you can be download it from here.
using the generated theme
flutter theme allows you to export your generated theme as a json
file using json_theme. to use this theme in your app, follow the steps below:
- add
json_theme
as a dependency in yourpubspec.yaml
file.dependencies: json_theme: ^2.1.0+2
- copy the generated
json
file to your app project and place it under theassets/
folder. - update your
pubspec.yaml
file to include your asset.flutter: assets: - assets/flutter_theme.json
- update your
main
function to load your theme.void main() async { widgetsflutterbinding.ensureinitialized(); final themestr = await rootbundle.loadstring('assets/flutter_theme.json'); final themejson = jsondecode(themestr); final theme = themedecoder.decodethemedata(themejson)!; }
- you can then pass in
theme
to yourmaterialapp
widget to use it.materialapp( theme: theme, title: 'flutter theme', home: homepage(), );
for a complete example app using the generated json
theme file, see the app under the example/
folder.
Comments are closed.