Created
January 23, 2020 19:16
-
-
Save VB10/abeb3dd3882e4fe884bdd9fae80d9e09 to your computer and use it in GitHub Desktop.
Paddıng Listview Core Widget
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| import 'package:healthoui/ui/shared/ui_helper.dart'; | |
| import 'package:healthoui/ui/shared/widget/padding/base_padding_enum.dart'; | |
| class PaddingListView extends StatelessWidget { | |
| final BasePaddingLevel spaceLevel; | |
| final List<Widget> widgets; | |
| const PaddingListView( | |
| {Key key, @required this.spaceLevel, @required this.widgets}) | |
| : super(key: key); | |
| @override | |
| Widget build(BuildContext context) { | |
| return ListView.builder( | |
| padding: EdgeInsets.all(SpaceValue.LOW), | |
| itemCount: widgets.length, | |
| itemBuilder: (context, index) { | |
| return Container( | |
| margin: EdgeInsets.only(bottom: _spaceValue), | |
| child: widgets[index], | |
| ); | |
| }, | |
| ); | |
| } | |
| double get _spaceValue { | |
| switch (spaceLevel) { | |
| case BasePaddingLevel.VERY_LOW: | |
| return 10; | |
| case BasePaddingLevel.LOW: | |
| return 15; | |
| case BasePaddingLevel.MIDDLE: | |
| return 25; | |
| case BasePaddingLevel.HIGH: | |
| return 50; | |
| default: | |
| return 20; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment