Skip to content

milawoai/flutter_globalui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

globalui

A pure Flutter UI Manager Library.

Show UI without context

Usage

1. Add library to your pubspec.yaml

dependencies:
  globalui: ^2.3.1 # such as version, you need use the latest version of pub.

2. Import library in root file

import 'package:globalui/globalui.dart';

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

3. Use Wrapper to Wrap

class MyApp extends StatelessWidget {
 @override
  Widget build(BuildContext context) {
    return GuiWrapper(
        child: MaterialApp(
          ...
        )
    );
  }

}

if user want to use custom style to override default, Lib offer some themes;

class MyApp extends StatelessWidget {
 @override
  Widget build(BuildContext context) {
    return GuiWrapper(
         toastTheme: ToastTheme(
              textStyle: TextStyle(color: Colors.red, fontSize: 20.0)
      ),
      modalTheme: ModalTheme(
              .....
      ),
        child: MaterialApp(
          ...
        )
    );
  }

}

4. Show UI Without context

Currently, We offer two kind of UI:

toast like

will hide themselves in seconds

showToast("tast");
Widget widget = Container(.....)

showToastWidget(widget);

modal like

will hide themselves by user action

showCancelConfirmModal(
                    title: "testTitle",
                    msg: "测试消息",
                    cancelText: "BYE",
                    onCancelPressed: () {
                      print("click cancel");
                    },
                    confirmText: "Hi",
                    confirmTextStyle: TextStyle(color: Colors.white, fontSize: 15.0),
                    confirmBackgroundColor: Colors.red,
                    onConfirmPressed: () {
                      print("click confirm");
                    },
                  );
showCancelModal(
                    title: "测试标题",
                    msg: "测试消息",
                    onCancelPressed: () {
                      print("showCancelModal");
                    });
Widget widget = Container(.....)

showModalWidget(widget);

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages