84 lines
2.2 KiB
Dart
84 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class CommonElements {
|
|
Widget roundButton(
|
|
AssetImage image,
|
|
ontap,
|
|
isAsync,
|
|
double imgHight,
|
|
EdgeInsets padding,
|
|
) {
|
|
return Container(
|
|
child: ClipOval(
|
|
child: Material(
|
|
color: Color(0xffFFD58D), // button color
|
|
child: InkWell(
|
|
splashColor: Color(0xffD28928), // inkwell color
|
|
child: Padding(
|
|
padding: padding,
|
|
child: Image(image: image, height: imgHight)),
|
|
onTap: () async {
|
|
await ontap;
|
|
}),
|
|
),
|
|
),
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
color: Colors.white,
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.grey,
|
|
blurRadius: 4.0,
|
|
offset: Offset(2.0, 2.5),
|
|
spreadRadius: 0.5)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class SmoothTransition extends PageRouteBuilder {
|
|
final Widget page;
|
|
SmoothTransition({this.page})
|
|
: super(
|
|
pageBuilder: (
|
|
BuildContext context,
|
|
Animation<double> animation,
|
|
Animation<double> secondaryAnimation,
|
|
) =>
|
|
TweenAnimationBuilder(
|
|
duration: const Duration(seconds: 5),
|
|
tween: Tween(begin: 200, end: 200),
|
|
builder: (BuildContext context, dynamic value, Widget child) {
|
|
return page;
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
class SlideLeftRoute extends PageRouteBuilder {
|
|
final Widget page;
|
|
SlideLeftRoute({this.page})
|
|
: super(
|
|
pageBuilder: (
|
|
BuildContext context,
|
|
Animation<double> animation,
|
|
Animation<double> secondaryAnimation,
|
|
) =>
|
|
page,
|
|
transitionsBuilder: (
|
|
BuildContext context,
|
|
Animation<double> animation,
|
|
Animation<double> secondaryAnimation,
|
|
Widget child,
|
|
) =>
|
|
SlideTransition(
|
|
position: Tween<Offset>(
|
|
begin: const Offset(1, 0),
|
|
end: Offset.zero,
|
|
).animate(animation),
|
|
child: child,
|
|
),
|
|
);
|
|
}
|