build method
dynamic
build( - dynamic context,
- dynamic ref
)
Implementation
@override
Widget build(BuildContext context, WidgetRef ref) {
final currentSelectedSpace = ref.watch(selectedSpaceIdProvider);
final selectedSpace = currentSelectedSpace != null;
final emptyButton = OutlinedButton(
key: openKey,
onPressed: () => selectSpace(context, ref),
child: Text(emptyText ?? L10n.of(context).pleaseSelectSpace),
);
return FormField(
builder: (state) => selectedSpace
? InkWell(
key: openKey,
onTap: () => selectSpace(context, ref),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (!useCompatView)
Text(
title ?? L10n.of(context).space,
style: Theme.of(context).textTheme.bodyMedium,
),
Consumer(builder: spaceBuilder),
],
),
)
: Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: state.hasError
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
emptyButton,
Text(
state.errorText!,
style:
Theme.of(context).textTheme.bodySmall!.copyWith(
color: Theme.of(context).colorScheme.error,
),
),
],
)
: emptyButton,
),
validator: (val) =>
!mandatory || ref.read(selectedSpaceIdProvider) != null
? null
: L10n.of(context).youMustSelectSpace,
);
}