dialog_switcher 0.0.1 dialog_switcher: ^0.0.1 copied to clipboard
Allows user to switch widgets gracefully within a dialog with Animation.
DialogSwitcher For Flutter #
Allows user to switch widgets gracefully within a dialog with Animation.
Screenshots #
Usage #
To use this plugin, add dialog_switcher
as a dependency in your pubspec.yaml file.
dependencies:
flutter:
sdk: flutter
dialog_switcher:
First and foremost, import the widget.
import 'package:dialog_switcher/dialog_switcher.dart';
You can now add an DialogSwitcher
widget to your widget tree and pass the child as the only required parameter to get started.
This widget will create a route between the source and the destination LatLng's provided.
DialogSwitcher(
child: Text("Hello World"),
),
If an onTap, onLongPress etc. parameters are provided, it can be used as a button.
DialogSwitcher(
child: Text("Hello World"),
onTap: () => print("Hello World"),
),
Want to add some padding
/margin
/borderRadius
?
Padding from all sides can be added by passing padding
as a double.
If you want to customize padding, then use customPadding
which expects EdgeInsets
allowing for customization.
If customPadding
is passed, padding
is ignored.
Same applies for margin and borderRadius.
DialogSwitcher(
child: Text("Hello World"),
onTap: () => print("Hello World"),
/// Shorthand for EdgeInsets.all(20)
padding: 20,
/// if customPadding passed, padding is ignored.
/// Hence padding applied to container is 10 from all sides.
customPadding: EdgeInsets.all(10),
),
The default alignment
is center.
So the container tries to take as much space as possible.
To deny the same, you can set the alignment
to null or specify height/width.
DialogSwitcher(
child: Text("Hello World"),
onTap: () => print("Hello World"),
/// child not longer takes all the available space
alignment: null,
),
To enable a border, showBorder
must be true. Defaults to false.
If showBorder
is true, parameters like borderColor, borderWidth, borderStyle come into play.
DialogSwitcher(
child: Text("Hello World"),
onTap: () => print("Hello World"),
showBorder: true,
borderWidth: 5,
borderColor: Colors.red,
),
Sample Usage
import 'package:dialog_switcher/dialog_switcher.dart';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: SafeArea(
child: Scaffold(
body: Center(
child: DialogSwitcher(
height: 150,
child: Text(
"Hello World ...",
style: TextStyle(fontSize: 25),
),
padding: 20,
elevation: 10,
onTap: () => print("Container Tapped"),
margin: 20,
borderRadius: 20,
color: Colors.orange,
),
),
),
),
);
}
}
And a lot more....
There is a lot of customization available which is self explantory.
You can the read the full documentation here
.
See the example
directory for a complete sample app.
Created & Maintained By Rithik Bhandari
#
- GitHub: @rithik-dev
- LinkedIn: @rithik-bhandari