From 576d826792133120bdac143ee79359d3040438ef Mon Sep 17 00:00:00 2001 From: laiiihz Date: Thu, 17 Dec 2020 16:02:33 +0800 Subject: [PATCH] add edgeInsets gen --- example/lib/data/extension/example_num_ext.dart | 13 +++++++++++++ lib/extension/num_extension.dart | 3 +++ 2 files changed, 16 insertions(+) diff --git a/example/lib/data/extension/example_num_ext.dart b/example/lib/data/extension/example_num_ext.dart index c56114e..9ee04b2 100644 --- a/example/lib/data/extension/example_num_ext.dart +++ b/example/lib/data/extension/example_num_ext.dart @@ -82,6 +82,19 @@ class _ExampleNumExtState extends State { ), ), ), + ListTile(title: Text('EdgeInsets')), + ListTile( + leading: Chip(label: Text('.edge')), + title: Text('EdgeInsets Gen'), + subtitle: Text('10.edge'), + trailing: Container( + height: 30.w, + width: 30.w, + color: Colors.red, + padding: 10.edge, + child: Container(color: Colors.green), + ), + ), ], ), ); diff --git a/lib/extension/num_extension.dart b/lib/extension/num_extension.dart index bd6e0ab..abd876b 100644 --- a/lib/extension/num_extension.dart +++ b/lib/extension/num_extension.dart @@ -9,6 +9,9 @@ extension NumExt on num { ///获取高 SizedBox Widget get hb => SizedBox(height: this.w); + ///获取 EdgeInsets.all + EdgeInsets get edge => EdgeInsets.all(this.w); + ///圆角 BorderRadius get radius => BorderRadius.circular(this.w);