d_info 0.0.8 copy "d_info: ^0.0.8" to clipboard
d_info: ^0.0.8 copied to clipboard

outdated

Flutter package for response info message

example/lib/main.dart

import 'package:d_info/d_info.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

void main() {
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return const GetMaterialApp(
      debugShowCheckedModeBanner: false,
      home: Home(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("D'Info")),
      body: ListView(
        padding: const EdgeInsets.symmetric(horizontal: 16),
        children: [
          const ListTile(title: Text('Dialog')),
          ElevatedButton(
            onPressed: () {
              DInfo.dialogSuccess('Payment Success');
              DInfo.closeDialog(
                  durationBeforeClose: const Duration(seconds: 1));
            },
            child: const Text('Success'),
          ),
          ElevatedButton(
            onPressed: () {
              DInfo.dialogError('Payment Failed');
              DInfo.closeDialog();
            },
            child: const Text('Error'),
          ),
          ElevatedButton(
            onPressed: () async {
              bool? isYes = await DInfo.dialogConfirmation(
                context,
                'Logout?',
                'You sure logout from this account?',
              );
              if (isYes ?? false) {
                print('user click yes');
              } else {
                print('user click no');
              }
            },
            child: const Text('Confirmation'),
          ),
          const Divider(),
          const ListTile(title: Text('Toast')),
          ElevatedButton(
            onPressed: () {
              DInfo.toastError('Pick Color has Failed');
            },
            child: const Text('Error'),
          ),
          ElevatedButton(
            onPressed: () {
              DInfo.toastSuccess('Login Success');
            },
            child: const Text('Success'),
          ),
          ElevatedButton(
            onPressed: () {
              DInfo.toastNetral('Add to Cart');
            },
            child: const Text('Netral'),
          ),
          ElevatedButton(
            onPressed: () {
              DInfo.closeToast();
            },
            child: const Text('Close Toast'),
          ),
          const Divider(),
          const ListTile(title: Text('SnackBar')),
          ElevatedButton(
            onPressed: () {
              DInfo.snackBarError('Input Failed');
            },
            child: const Text('Error'),
          ),
          ElevatedButton(
            onPressed: () {
              DInfo.snackBarSuccess('Login Success');
            },
            child: const Text('Success'),
          ),
          ElevatedButton(
            onPressed: () {
              DInfo.snackBarNetral('Add to Cart');
            },
            child: const Text('Netral'),
          ),
          ElevatedButton(
            onPressed: () {
              DInfo.closeSnackBarOrNotif();
            },
            child: const Text('Close SnackBar'),
          ),
          const Divider(),
          const ListTile(title: Text('Notif')),
          ElevatedButton(
            onPressed: () {
              DInfo.notifError('Upload', "Fail upload image");
            },
            child: const Text('Error'),
          ),
          ElevatedButton(
            onPressed: () {
              DInfo.notifSuccess('Upload', "Success upload image");
            },
            child: const Text('Success'),
          ),
          ElevatedButton(
            onPressed: () {
              DInfo.notifNetral('Task', "You add new task");
            },
            child: const Text('Netral'),
          ),
          ElevatedButton(
            onPressed: () {
              DInfo.closeSnackBarOrNotif();
            },
            child: const Text('Close Notif'),
          ),
          const SizedBox(height: 60),
        ],
      ),
    );
  }
}
7
likes
0
points
89
downloads

Publisher

verified publisherindratrisnar.com

Weekly Downloads

Flutter package for response info message

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, fluttertoast, get

More

Packages that depend on d_info