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

Constants methods and widgets are used in this package.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:priyank/constant_methods.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Priyank',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Priyank'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);
  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            InkWell(
              onTap: () {
                ConstantMethods().launcher('https://www.google.co.in/');
              },
              child: Text('Go to Google'),
            ),
            InkWell(
              onTap: () {
                ConstantMethods()
                    .shareData(message: 'https://pub.flutter-io.cn/packages/priyank');
              },
              child: Text('Share'),
            ),
            MaterialButton(
              onPressed: () {
                ConstantMethods().singleButtonAlert(
                    context, 'This is an alert dialog', 'OK', true);
              },
              child: Text('Show Alert Dialog'),
            ),
            MaterialButton(
              onPressed: () {
                ConstantMethods().doubleButtonAlert(
                    context, // BuildContext
                    'Message', // title
                    'This is an alert dialog', // message
                    'Cancel', // cancelButtonText
                    'Next', // nextButtonText
                    () {
                  // // function
                  ConstantMethods()
                      .showSnackBar(context, 'Hello', Colors.black, 2);
                }, true // barrierDismissible
                    );
              },
              child: Text('Show double button alert Dialog'),
            ),
          ],
        ),
      ),
    );
  }
}
2
likes
105
points
5
downloads

Publisher

verified publisherthepriyank.com

Weekly Downloads

Constants methods and widgets are used in this package.

Documentation

API reference

License

unknown (license)

Dependencies

cached_network_image, flutter, intl, permission_handler, share, url_launcher

More

Packages that depend on priyank