Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加TFormRowTypeSelector的无数据情况 #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/form/form_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class _TFormFieldState extends State<TFormField> {
switch (widget.row.type) {
case TFormRowTypeMultipleSelector:
case TFormRowTypeSelector:
if (row.options == null || row.options.isEmpty) return;
if (row.options == null) return;
value = await Navigator.push(
context,
MaterialPageRoute(
Expand Down
24 changes: 14 additions & 10 deletions lib/form/form_selector_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,20 @@ class TFormSelectorPage extends StatelessWidget {
: SizedBox.shrink(),
],
),
body: ListView.builder(
itemCount: options.length,
itemBuilder: (BuildContext context, int index) {
return LTListTitle(
isMultipleSelector: isMultipleSelector,
model: options[index],
options: options,
);
},
),
body: options.length > 0
? ListView.builder(
itemCount: options.length,
itemBuilder: (BuildContext context, int index) {
return LTListTitle(
isMultipleSelector: isMultipleSelector,
model: options[index],
options: options,
);
},
)
: ListTile(
title: Text("无数据", style: TextStyle(color: Colors.grey)),
),
);
}
}
Expand Down