Skip to content

Commit 19b1582

Browse files
authored
Merge pull request #77 from chomosuke/add-material-mouseRegion
Add Material & MouseRegion extention
2 parents 26a10fb + 2d6febd commit 19b1582

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

lib/src/extensions/widget_extension.dart

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,4 +1384,50 @@ extension StyledWidget on Widget {
13841384
maxHeight: maxHeight,
13851385
child: this,
13861386
);
1387+
1388+
Widget material({
1389+
Key? key,
1390+
MaterialType type = MaterialType.canvas,
1391+
double elevation = 0.0,
1392+
Color? color,
1393+
Color? shadowColor,
1394+
TextStyle? textStyle,
1395+
BorderRadiusGeometry? borderRadius,
1396+
ShapeBorder? shape,
1397+
bool borderOnForeground = true,
1398+
Clip clipBehavior = Clip.none,
1399+
Duration animationDuration = kThemeChangeDuration,
1400+
}) =>
1401+
Material(
1402+
key: key,
1403+
type: type,
1404+
elevation: elevation,
1405+
color: color,
1406+
shadowColor: shadowColor,
1407+
textStyle: textStyle,
1408+
borderRadius: borderRadius,
1409+
shape: shape,
1410+
borderOnForeground: borderOnForeground,
1411+
clipBehavior: clipBehavior,
1412+
animationDuration: animationDuration,
1413+
child: this,
1414+
);
1415+
1416+
Widget mouseRegion({
1417+
Key? key,
1418+
void Function(PointerEnterEvent)? onEnter,
1419+
void Function(PointerExitEvent)? onExit,
1420+
void Function(PointerHoverEvent)? onHover,
1421+
MouseCursor cursor = MouseCursor.defer,
1422+
bool opaque = true,
1423+
}) =>
1424+
MouseRegion(
1425+
key: key,
1426+
onEnter: onEnter,
1427+
onExit: onExit,
1428+
onHover: onHover,
1429+
cursor: cursor,
1430+
opaque: opaque,
1431+
child: this,
1432+
);
13871433
}

0 commit comments

Comments
 (0)