mirror of
https://github.com/go-vikunja/app
synced 2024-06-01 02:06:51 +00:00
bucket formatting
This commit is contained in:
parent
b10a6577a1
commit
b4989181dc
|
@ -23,31 +23,23 @@ class _BucketListViewState extends State<BucketListView> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width * 0.8,
|
||||
child: ListView.builder(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||
itemBuilder: (context, i) {
|
||||
if (i == 0) {
|
||||
return Text(_currentBucket.title);
|
||||
}
|
||||
return ListView.builder(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||
itemBuilder: (context, i) {
|
||||
if (_currentBucket.tasks == null || i >= _currentBucket.tasks.length) {
|
||||
if (i == 0 || i == _currentBucket.tasks?.length)
|
||||
return TextButton.icon(
|
||||
onPressed: widget.onAddTask,
|
||||
label: Text('Add Task'),
|
||||
icon: Icon(Icons.add),
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
final index = i - 1;
|
||||
|
||||
if (_currentBucket.tasks == null || index >= _currentBucket.tasks.length) {
|
||||
if (index == 0 || index == _currentBucket.tasks?.length)
|
||||
return TextButton(
|
||||
onPressed: widget.onAddTask,
|
||||
child: Text('+ Add Task'),
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
return index < _currentBucket.tasks.length
|
||||
? _buildBucketTaskTile(_currentBucket.tasks[index])
|
||||
: null;
|
||||
},
|
||||
),
|
||||
return i < _currentBucket.tasks.length
|
||||
? _buildBucketTaskTile(_currentBucket.tasks[i])
|
||||
: null;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -151,14 +151,10 @@ class _ListPageState extends State<ListPage> {
|
|||
ListView _kanbanView(BuildContext buildContext) {
|
||||
return ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
padding: EdgeInsets.symmetric(vertical: 10),
|
||||
itemBuilder: (context, i) {
|
||||
if (taskState.maxPages == _currentPage && i >= taskState.buckets.length) {
|
||||
if (i == taskState.buckets.length)
|
||||
return TextButton(
|
||||
onPressed: () => _addBucketDialog(buildContext),
|
||||
child: Text('+ Create Bucket'),
|
||||
);
|
||||
return _buildBucketTile();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -198,10 +194,38 @@ class _ListPageState extends State<ListPage> {
|
|||
);
|
||||
}
|
||||
|
||||
BucketListView _buildBucketTile(Bucket bucket) {
|
||||
return BucketListView(
|
||||
bucket: bucket,
|
||||
onAddTask: () => _addItemDialog(context, bucket),
|
||||
Container _buildBucketTile([Bucket bucket]) {
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width * 0.8,
|
||||
child: Column(
|
||||
children: () {
|
||||
if (bucket != null) {
|
||||
return <Widget>[
|
||||
ListTile(
|
||||
title: Text(bucket.title),
|
||||
trailing: Icon(Icons.more_vert),
|
||||
),
|
||||
Expanded(
|
||||
child: BucketListView(
|
||||
bucket: bucket,
|
||||
onAddTask: () => _addItemDialog(context, bucket),
|
||||
),
|
||||
),
|
||||
];
|
||||
} else {
|
||||
return <Widget>[
|
||||
ListTile(
|
||||
title: TextButton.icon(
|
||||
onPressed: () => _addBucketDialog(context),
|
||||
label: Text('Create Bucket'),
|
||||
icon: Icon(Icons.add),
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
];
|
||||
}
|
||||
}(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user