desktop_flow 0.0.1 copy "desktop_flow: ^0.0.1" to clipboard
desktop_flow: ^0.0.1 copied to clipboard

outdated

A flutter package to help you create desktop apps.

example/lib/main.dart

import 'package:bitsdojo_window/bitsdojo_window.dart';
import 'package:desktop_flow/desktop_flow.dart';
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
  doWhenWindowReady(() {
    const size = Size(800, 600);
    appWindow.alignment = Alignment.center;
    appWindow.size = size;
    appWindow.minSize = size;
    appWindow.show();
  });
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: DesktopFlow(
        firstScreen: const Home(),
        initialPageTitle: "Página inicial",
        lateralMenuBackground: Colors.grey.shade200,
        topBarActions: [
          ActionButton(
              icon: FluentIcons.dismiss_20_regular,
              tooltip: "Cancelar",
              onTap: () =>
                  DesktopController().changeActionButtonsVisibility(false),
              backgroundColor: Colors.red.shade100),
          ActionButton(
              icon: FluentIcons.save_20_regular,
              tooltip: "Salvar",
              onTap: () {},
              backgroundColor: Colors.green.shade100),
        ],
        lateralMenuItems: [
          MenuItem(
              index: 0,
              icon: FluentIcons.home_20_regular,
              tooltip: "Página inicial",
              onTap: () => {},
              backgroundColor: Colors.orange.shade300),
          MenuItem(
              index: 1,
              icon: FluentIcons.person_20_regular,
              tooltip: "Segunda Tela",
              onTap: () =>
                  DesktopController().changeActionButtonsVisibility(true),
              backgroundColor: Colors.orange.shade300),
          MenuItem(
              index: 2,
              icon: FluentIcons.settings_20_regular,
              tooltip: "Terceira Tela",
              onTap: () => {},
              backgroundColor: Colors.orange.shade300)
        ],
      ),
    );
  }
}

class Home extends StatelessWidget {
  const Home({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            TextButton(
                onPressed: () => DesktopController().change(
                    pageTitle: "Configurações",
                    selectedMenuItem: 2,
                    screen: Settings()),
                child: Text("Ir para a tela de configurações"))
          ],
        ),
      ),
    );
  }
}

class Settings extends StatelessWidget {
  const Settings({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            TextButton(
                onPressed: () => DesktopController().change(
                    pageTitle: "Página inicial",
                    selectedMenuItem: 0,
                    screen: Home()),
                child: Text("Ir para a tela inicial")),
            TextButton(
                onPressed: () =>
                    DesktopController().changeActionButtonsVisibility(true),
                child: Text("Mostrar ações")),
            TextButton(
                onPressed: () {
                  List<ActionButton> _actions =
                      DesktopController().actionButtons;
                  _actions.add(ActionButton(
                      icon: FluentIcons.check_20_regular,
                      tooltip: "Check",
                      onTap: () {},
                      backgroundColor: Colors.yellow.shade100));
                  DesktopController().changeActionButtons(_actions);
                },
                child: Text("Adicionar ação"))
          ],
        ),
      ),
    );
  }
}
0
likes
130
points
17
downloads

Publisher

unverified uploader

Weekly Downloads

A flutter package to help you create desktop apps.

Homepage

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

bitsdojo_window, flutter, provider

More

Packages that depend on desktop_flow