vdialog 0.2.4 copy "vdialog: ^0.2.4" to clipboard
vdialog: ^0.2.4 copied to clipboard

Flutter package to show beautiful dialogs with animations as simply as possible.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:vdialog/vdialog.dart';

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

//class MyApp extends StatefulWidget {
//  // This widget is the root of your application.
//  @override
//  _MyAppState createState() => _MyAppState();
//}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: "Test",
      home: Testing(),
    );
  }
}
//class _MyAppState extends State<MyApp> {
//  @override
//  Widget build(BuildContext context) {
//    return MaterialApp(
//      title: 'Flutter Demo',
//      theme: ThemeData(
//        primarySwatch: Colors.blue,
//      ),
//      home: Testing(),
//    );
//  }
//
//
//
//
//
////  void showVDialog() {
////    showDialog(
////      barrierDismissible: false,
////      context: context,
////      builder: (BuildContext ctx) => CustomDialog(
////        titleContainerWidget: customTitleText(),
////        contentContainerWidget: customContentText(),
////        customButtonOneWidget: customButtonOne(),
////        customButtonTwoWidget: customButtonTwo(),
////        showButtonOne: true,
////        showButtonTwo: true,
////        icon: Icons.settings,
////        iconHexColor: "5E35B1",
////        iconBackgroundHexColor: "EF5350",
////        alignmentIcon: mainAlignment.center,
////        haveAnimation: true,
////        animationsType: mAnimations.slide,
////        slideInTypes: SlideInTypes.SlideInBottom,
////        animationMilliseconds: 500,
////      ),
////    );
////  }
////
////  void loadData() {
////    //this is data function!
////  }
////
////
////  void _buttonOne() {
////    loadData();
////  }
////
////  void _buttonTwo() {
////    SystemNavigator.pop();
//////    Navigator.of(context).pop();
////  }
////
////  Widget customTitleText() {
////    return Container(
////      width: double.infinity,
////      alignment: Alignment.center,
////      child: Text(
////        "Custom title",
////        textAlign: TextAlign.end,
////        style: TextStyle(
////          fontSize: 24,
////        ),
////      ),
////    );
////  }
////
////  Widget customContentText() {
////    return Container(
////      width: double.infinity,
////      alignment: Alignment.center,
////      child: Text(
////        "Custom Content",
////        textAlign: TextAlign.end,
////        style: TextStyle(
////          fontSize: 24,
////        ),
////      ),
////    );
////  }
////
////  Widget customButtonOne() {
////    return Container(
////      margin: EdgeInsets.only(right: 20),
////      padding: EdgeInsets.all(
////        10,
////      ),
////      decoration: BoxDecoration(
////        borderRadius: BorderRadius.circular(40),
////        color: Colors.yellow,
////      ),
////      child: FlatButton(
////        onPressed: () {
////          loadData();
////          Navigator.of(context).pop(); // To close the dialog
////        },
////        child: Text(
////          "button one",
////        ),
////      ),
////    );
////  }
////
////  Widget customButtonTwo() {
////    return Container(
////      margin: EdgeInsets.only(right: 20),
////      child: FlatButton(
////        color: Colors.red,
////        onPressed: () {
////          loadData();
////          Navigator.of(context).pop(); // To close the dialog
////        },
////        child: Text(
////          "button two",
////          style: TextStyle(color: Colors.white),
////        ),
////      ),
////    );
////  }
//}

class Testing extends StatefulWidget {
  @override
  _TestingState createState() => _TestingState();
}

class _TestingState extends State<Testing> {
  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        body: SafeArea(
          child: RaisedButton(
            child: Text("show dialog"),
            onPressed: () => showVDialog(context),
          ),
        ),
      ),
    );
  }


  void showVDialog(BuildContext context) {
    try {
      showDialog(
        barrierDismissible: false,
        context: context,
        builder: (BuildContext ctx) => CustomDialog(
          titleContainerWidget: customTitleText(),
          contentContainerWidget: customContentText(),
          customButtonOneWidget: customButtonOne(),
          customButtonTwoWidget: customButtonTwo(),
          showTitle: true,
          showContent: false,
          showIcon: false,
          showButtonOne: true,
          showButtonTwo: true,
          icon: Icons.add_photo_alternate,
          iconSize: 10,
          iconHexColor: "ffffff",
          iconBackgroundHexColor: "EF5350",
          alignmentIcon: mainAlignment.center,
          haveAnimation: true,
          animationsType: mAnimations.slide,
          slideInTypes: SlideInTypes.SlideInBottom,
          animationMilliseconds: 500,
        ),
      );
    } catch (error) {
      String asd="";
    }
  }

  Future<void> _buttonOne() async {
//    Navigator.of(context).pop();
//    Navigator.of(context)
//        .pushNamed(MainSearch.routeName, arguments: {'isUser': true});
  }

  void _buttonTwo() {
//    Navigator.of(context).pop();
//    Navigator.of(context)
//        .pushNamed(MainSearch.routeName, arguments: {'isUser': false});
  }

  Widget customTitleText() {
    return Container(
      width: double.infinity,
      alignment: Alignment.center,
      child: Text(
        "Search in",
        textAlign: TextAlign.end,
        textDirection: TextDirection.rtl,
        style: TextStyle(fontSize: 12, fontFamily: 'IRANSans'),
      ),
    );
  }

  Widget customContentText() {
    return Container(
      width: double.infinity,
      alignment: Alignment.center,
      child: Text(
        "",
        textAlign: TextAlign.end,
        textDirection: TextDirection.rtl,
        style: TextStyle(fontSize: 0, fontFamily: 'IRANSans'),
      ),
    );
  }

  Widget customButtonOne() {
    return Container(
      margin: EdgeInsets.only(right: 20),
      height: 80,
      width: MediaQuery.of(context).size.width*0.25,
      decoration: BoxDecoration(
          color: Colors.redAccent,
          borderRadius: BorderRadius.all(Radius.circular(10))
      ),
      child: GestureDetector(
        onTap: () => _buttonOne(),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Icon(
              Icons.local_mall,
            ),
            SizedBox(
              height: 10,
            ),
            Text(
              "Products",
              style: TextStyle(
                  color: Colors.white, fontFamily: 'IRANSans', fontSize: 12),
            ),
          ],
        ),
      ),
    );
  }

  Widget customButtonTwo() {
    return Container(
      margin: EdgeInsets.only(right: 20),
      height: 80,
      width: MediaQuery.of(context).size.width*0.25,
      decoration: BoxDecoration(
          color: Colors.redAccent,
          borderRadius: BorderRadius.all(Radius.circular(10))
      ),
      child: GestureDetector(
        onTap: () => _buttonTwo(),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Icon(
              Icons.group,
            ),
            SizedBox(
              height: 10,
            ),
            Text(
              "Users",
              style: TextStyle(
                  color: Colors.white, fontFamily: 'IRANSans', fontSize: 12),
            ),
          ],
        ),
      ),
    );
  }
}
5
likes
40
pub points
9%
popularity

Publisher

unverified uploader

Flutter package to show beautiful dialogs with animations as simply as possible.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on vdialog