flutter_hud 0.3.0 copy "flutter_hud: ^0.3.0" to clipboard
flutter_hud: ^0.3.0 copied to clipboard

outdated

A clean and lightweight progress HUD to show a running asynchronous task for Flutter.

example/lib/main.dart

import 'package:example/hud/hud_cancelable.dart';
import 'package:example/hud/hud_default.dart';
import 'package:example/hud/hud_label.dart';
import 'package:example/hud/hud_label_detail.dart';
import 'package:example/hud/hud_popup.dart';
import 'package:example/hud/hud_popup_cancelable.dart';
import 'package:example/hud/hud_popup_progress.dart';
import 'package:example/hud/hud_progress.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: HUDList(),
    );
  }
}

class HUDList extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Flutter HUD'),
      ),
      body: ListView(
        children: ListTile.divideTiles(
          context: context,
          tiles: <Widget>[
            TileGroup('HUD WIDGET'),
            TileItem(
              label: HUDDefault.title,
              description: 'Show default centered activity indicator',
              builder: (context) => HUDDefault(),
            ),
            TileItem(
              label: HUDWithLabel.title,
              description: '"${HUDDefault.title}" with a label below',
              builder: (context) => HUDWithLabel(),
            ),
            TileItem(
              label: HUDWithLabelDetail.title,
              description:
                  '"${HUDDefault.title}" with label and detailed label below',
              builder: (context) => HUDWithLabelDetail(),
            ),
            TileItem(
              label: HUDWithCancelable.title,
              description:
                  '"${HUDWithLabelDetail.title}" with cancelable button',
              builder: (context) => HUDWithCancelable(),
            ),
            TileItem(
              label: HUDWidgetProgress.title,
              description: '"${HUDWithLabelDetail.title}" with progress',
              builder: (context) => HUDWidgetProgress(),
            ),
            TileGroup('HUD POPUP'),
            TileItem(
              label: HUDUsingPopup.title,
              description: 'Show HUD using `ModalRoute`',
              builder: (context) => HUDUsingPopup(),
            ),
            TileItem(
              label: HUDUsingPopupCancelable.title,
              description: '"${HUDUsingPopup.title}" with cancelable options',
              builder: (context) => HUDUsingPopupCancelable(),
            ),
            TileItem(
              label: HUDPopupProgress.title,
              description: '"${HUDUsingPopup.title}" with progress',
              builder: (context) => HUDPopupProgress(),
            ),
          ].map((t) => t),
        ).toList(),
      ),
    );
  }
}

class TileGroup extends StatelessWidget {
  TileGroup(this.header);

  final String header;

  @override
  Widget build(BuildContext context) {
    return Material(
      color: Colors.grey[100],
      child: ListTile(
        title: Text(
          header.toUpperCase(),
          style: TextStyle(
            fontWeight: FontWeight.w500,
          ),
        ),
      ),
    );
  }
}

class TileItem extends StatelessWidget {
  TileItem({
    this.label,
    this.description,
    this.builder,
  });

  final String label;
  final String description;
  final WidgetBuilder builder;

  @override
  Widget build(BuildContext context) {
    return ListTile(
      onTap: () => Navigator.push(
        context,
        MaterialPageRoute(builder: builder),
      ),
      title: Text(label),
      subtitle: Text(description),
      trailing: Icon(Icons.chevron_right),
    );
  }
}
19
likes
0
pub points
88%
popularity

Publisher

verified publisheralan.my.id

A clean and lightweight progress HUD to show a running asynchronous task for Flutter.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on flutter_hud