Skip to content

Commit 8d39647

Browse files
authored
feat: Added image to signify the list returned is of length 0 (#58)
1 parent 7d833fe commit 8d39647

File tree

9 files changed

+289
-172
lines changed

9 files changed

+289
-172
lines changed

assets/logo/empty.svg

Lines changed: 6 additions & 0 deletions
Loading

lib/components/rss_filter_details.dart

Lines changed: 102 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/material.dart';
2+
import 'package:flutter_svg/svg.dart';
23
import 'package:fluttertoast/fluttertoast.dart';
34
import 'package:provider/provider.dart';
45
import 'package:rutorrentflutter/api/api_conf.dart';
@@ -37,103 +38,116 @@ class _RSSFilterDetailsState extends State<RSSFilterDetails> {
3738
? LoadingShimmer().loadingEffect(context)
3839
: Column(
3940
children: <Widget>[
40-
Expanded(
41-
child: ListView.builder(
42-
itemCount: rssFilters.length,
43-
itemBuilder: (context, index) {
44-
return Container(
45-
child: Padding(
46-
padding: const EdgeInsets.all(8.0),
47-
child: Column(
48-
crossAxisAlignment: CrossAxisAlignment.start,
49-
children: <Widget>[
50-
Row(
51-
mainAxisAlignment:
52-
MainAxisAlignment.spaceBetween,
53-
children: <Widget>[
54-
Text(
55-
'${index + 1}. ${rssFilters[index].name}',
56-
style: TextStyle(
57-
fontWeight: FontWeight.w600,
58-
fontSize: 16),
59-
),
60-
Checkbox(
61-
activeColor:
62-
Theme.of(context).primaryColor,
63-
onChanged: (val) {
64-
Fluttertoast.showToast(
65-
msg:
66-
'Please use ruTorrent web interface to change filter settings');
67-
},
68-
value: rssFilters[index].enabled == 1,
69-
)
70-
],
71-
),
72-
Padding(
41+
(rssFilters.length != 0)
42+
? Expanded(
43+
child: ListView.builder(
44+
itemCount: rssFilters.length,
45+
itemBuilder: (context, index) {
46+
return Container(
47+
child: Padding(
7348
padding: const EdgeInsets.all(8.0),
74-
child: Row(
49+
child: Column(
50+
crossAxisAlignment:
51+
CrossAxisAlignment.start,
7552
children: <Widget>[
76-
Text(
77-
'Pattern: ',
78-
style: TextStyle(
79-
fontWeight: FontWeight.w600),
53+
Row(
54+
mainAxisAlignment:
55+
MainAxisAlignment.spaceBetween,
56+
children: <Widget>[
57+
Text(
58+
'${index + 1}. ${rssFilters[index].name}',
59+
style: TextStyle(
60+
fontWeight: FontWeight.w600,
61+
fontSize: 16),
62+
),
63+
Checkbox(
64+
activeColor:
65+
Theme.of(context).primaryColor,
66+
onChanged: (val) {
67+
Fluttertoast.showToast(
68+
msg:
69+
'Please use ruTorrent web interface to change filter settings');
70+
},
71+
value:
72+
rssFilters[index].enabled == 1,
73+
)
74+
],
8075
),
81-
Flexible(
82-
child:
83-
Text(rssFilters[index].pattern)),
84-
],
85-
),
86-
),
87-
Padding(
88-
padding: const EdgeInsets.all(8.0),
89-
child: Row(
90-
children: <Widget>[
91-
Text(
92-
'Label: ',
93-
style: TextStyle(
94-
fontWeight: FontWeight.w600),
76+
Padding(
77+
padding: const EdgeInsets.all(8.0),
78+
child: Row(
79+
children: <Widget>[
80+
Text(
81+
'Pattern: ',
82+
style: TextStyle(
83+
fontWeight: FontWeight.w600),
84+
),
85+
Flexible(
86+
child: Text(
87+
rssFilters[index].pattern)),
88+
],
89+
),
9590
),
96-
Flexible(
97-
child: Text(rssFilters[index].label)),
98-
],
99-
),
100-
),
101-
Padding(
102-
padding: const EdgeInsets.all(8.0),
103-
child: Row(
104-
children: <Widget>[
105-
Text(
106-
'Exclude: ',
107-
style: TextStyle(
108-
fontWeight: FontWeight.w600),
91+
Padding(
92+
padding: const EdgeInsets.all(8.0),
93+
child: Row(
94+
children: <Widget>[
95+
Text(
96+
'Label: ',
97+
style: TextStyle(
98+
fontWeight: FontWeight.w600),
99+
),
100+
Flexible(
101+
child: Text(
102+
rssFilters[index].label)),
103+
],
104+
),
109105
),
110-
Flexible(
111-
child:
112-
Text(rssFilters[index].exclude)),
113-
],
114-
),
115-
),
116-
Padding(
117-
padding: const EdgeInsets.all(8.0),
118-
child: Row(
119-
children: <Widget>[
120-
Text(
121-
'Save Directory: ',
122-
style: TextStyle(
123-
fontWeight: FontWeight.w600),
106+
Padding(
107+
padding: const EdgeInsets.all(8.0),
108+
child: Row(
109+
children: <Widget>[
110+
Text(
111+
'Exclude: ',
112+
style: TextStyle(
113+
fontWeight: FontWeight.w600),
114+
),
115+
Flexible(
116+
child: Text(
117+
rssFilters[index].exclude)),
118+
],
119+
),
120+
),
121+
Padding(
122+
padding: const EdgeInsets.all(8.0),
123+
child: Row(
124+
children: <Widget>[
125+
Text(
126+
'Save Directory: ',
127+
style: TextStyle(
128+
fontWeight: FontWeight.w600),
129+
),
130+
Flexible(
131+
child: Text(
132+
rssFilters[index].dir)),
133+
],
134+
),
124135
),
125-
Flexible(
126-
child: Text(rssFilters[index].dir)),
136+
Divider(),
127137
],
128138
),
129139
),
130-
Divider(),
131-
],
132-
),
133-
),
134-
);
135-
}),
136-
),
140+
);
141+
}),
142+
)
143+
: Expanded(
144+
child: Center(
145+
child: SvgPicture.asset(
146+
'assets/logo/empty.svg',
147+
width: 120,
148+
height: 120,
149+
),
150+
)),
137151
],
138152
),
139153
);

0 commit comments

Comments
 (0)