turned spaced helper into a extension
This commit is contained in:
parent
5b5d65abce
commit
b62ee7317a
|
@ -8,8 +8,8 @@ import '../hooks/logged_in_action.dart';
|
|||
import '../hooks/memo_future.dart';
|
||||
import '../hooks/stores.dart';
|
||||
import '../util/extensions/api.dart';
|
||||
import '../util/extensions/spaced.dart';
|
||||
import '../util/goto.dart';
|
||||
import '../util/spaced.dart';
|
||||
import '../widgets/markdown_text.dart';
|
||||
import 'full_post.dart';
|
||||
|
||||
|
@ -197,7 +197,7 @@ class CreatePost extends HookWidget {
|
|||
),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: spaced(6, [
|
||||
children: [
|
||||
instanceDropdown,
|
||||
communitiesDropdown,
|
||||
url,
|
||||
|
@ -226,7 +226,7 @@ class CreatePost extends HookWidget {
|
|||
)
|
||||
],
|
||||
),
|
||||
]),
|
||||
].spaced(6),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
/// Creates gaps between given widgets
|
||||
extension SpaceWidgets on List<Widget> {
|
||||
List<Widget> spaced(double gap) => expand((item) sync* {
|
||||
yield SizedBox(width: gap, height: gap);
|
||||
yield item;
|
||||
}).skip(1).toList();
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
/// Creates gaps between given widgets
|
||||
List<Widget> spaced(double gap, Iterable<Widget> children) => children
|
||||
.expand((item) sync* {
|
||||
yield SizedBox(width: gap, height: gap);
|
||||
yield item;
|
||||
})
|
||||
.skip(1)
|
||||
.toList();
|
Loading…
Reference in New Issue