weui_v1 1.0.0-alpha copy "weui_v1: ^1.0.0-alpha" to clipboard
weui_v1: ^1.0.0-alpha copied to clipboard

flutter weui null safety

example/lib/main.dart

import 'package:flutter/material.dart';
import './views/index.dart';
import './router/index.dart';
import 'package:weui/weui.dart';

void main() => runApp(App());

class App extends StatefulWidget {
  @override
  AppState createState() => AppState();
}

class AppState extends State {
  bool isDefaultTheme = true;

  void toggleTheme() {
    this.setState(() {
      isDefaultTheme = !isDefaultTheme;
    });
  }

  @override
  Widget build(BuildContext context) {
    return WeUi(
      theme: isDefaultTheme ? WeTheme() : WeTheme(
        primaryColor: Color(0xff1989fa),
        primaryColorDisabled: Color(0xff5cadff),
        warnColor: Color(0xfffb4343),
        warnColorDisabled: Color(0xfffaa7a3)
      ),
      config: WeConfig(
        toastSuccessDuration: 5000
      ),
      child: MaterialApp(
        debugShowCheckedModeBanner: false,
        routes: routes,
        home: Index(this.toggleTheme)
      )
    );
  }
}
1
likes
45
points
13
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

flutter weui null safety

Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

Dependencies

flutter

More

Packages that depend on weui_v1