You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tangheem/lib/extensions/widget_extensions.dart

33 lines
1.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
extension WidgetExtensions on Widget {
Widget onPress(VoidCallback onTap) => InkWell(onTap: onTap, child: this, splashColor: Colors.transparent, highlightColor: Colors.transparent);
Widget get expanded => Expanded(child: this);
Widget get center => Center(child: this);
Widget circle(double _value) => ClipRRect(borderRadius: BorderRadius.circular(_value), child: this);
Widget paddingAll(double _value) => Padding(padding: EdgeInsets.all(_value), child: this);
Widget paddingOnly({double left = 0.0, double right = 0.0, double top = 0.0, double bottom = 0.0}) =>
Padding(padding: EdgeInsets.only(left: left, right: right, top: top, bottom: bottom), child: this);
Widget toExpanded({int flex = 1}) => Expanded(flex: flex, child: this);
// Widget toShimmer({bool isShow = true}) => isShow
// ? Shimmer.fromColors(
// baseColor: Color(0xffe8eff0),
// highlightColor: Colors.white,
// child: Container(
// color: Colors.white,
// child: this,
// ),
// )
// : Container(
// child: this,
// );
}