From 71146f59e0b20bbf32eeaa45b7df13f98d518f92 Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Mon, 7 Dec 2020 11:45:25 +0800 Subject: [PATCH] add separate extension --- lib/extension/separate_extension.dart | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 lib/extension/separate_extension.dart diff --git a/lib/extension/separate_extension.dart b/lib/extension/separate_extension.dart new file mode 100644 index 0000000..71caca5 --- /dev/null +++ b/lib/extension/separate_extension.dart @@ -0,0 +1,13 @@ +import 'package:ansu_ui/ansu_ui.dart'; +import 'package:flutter/material.dart'; + +extension SeparateExt on List { + List sep([Widget separate]) { + return List.generate(this.length * 2 - 1, (index) { + if (index.isEven) + return this[index ~/ 2]; + else + return separate ?? 10.wb; + }); + } +}