defaultSetting static method
Constructs and returns the default setting value, which will be used when some fields are null in both PlaceholderText.setting and PlaceholderTextTheme.setting.
Implementation
static PlaceholderSetting defaultSetting(BuildContext context) {
return PlaceholderSetting(
// animation
useAnimatedSwitcher: false,
switchDuration: const Duration(milliseconds: 200),
switchReverseDuration: const Duration(milliseconds: 200),
switchInCurve: Curves.linear,
switchOutCurve: Curves.linear,
switchTransitionBuilder: AnimatedSwitcher.defaultTransitionBuilder,
switchLayoutBuilder: AnimatedSwitcher.defaultLayoutBuilder,
// text
loadingText: 'Loading...',
nothingText: 'Nothing',
nothingRetryText: 'Retry',
unknownErrorText: 'Unknown error',
errorRetryText: 'Retry',
// icon
nothingIcon: Icons.clear_all,
errorIcon: Icons.error,
// padding
textPadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 5),
iconPadding: const EdgeInsets.all(5),
buttonPadding: const EdgeInsets.fromLTRB(5, 10, 5, 5),
progressPadding: const EdgeInsets.fromLTRB(5, 10, 5, 30),
wholePaddingUnlessNormal: EdgeInsets.zero,
// style
textStyle: Theme.of(context).textTheme.headline6?.copyWith(fontSize: 20, fontWeight: FontWeight.normal),
textMaxLines: 15,
textOverflow: TextOverflow.ellipsis,
buttonTextStyle: Theme.of(context).textTheme.button?.copyWith(fontSize: 14, fontWeight: FontWeight.normal, color: Theme.of(context).primaryColor),
buttonStyle: Theme.of(context).outlinedButtonTheme.style?.copyWith(tapTargetSize: MaterialTapTargetSize.shrinkWrap),
iconSize: 50,
iconColor: Colors.grey,
progressSize: 50,
progressStrokeWidth: 4.5,
// show xxx
showLoadingProgress: true,
showLoadingText: true,
showNothingIcon: true,
showNothingText: true,
showNothingRetry: true,
showErrorIcon: true,
showErrorText: true,
showErrorRetry: true,
// custom builder
customLoadingProgressBuilder: null,
customLoadingTextBuilder: null,
customNothingIconBuilder: null,
customNothingTextBuilder: null,
customNothingRetryBuilder: null,
customErrorIconBuilder: null,
customErrorTextBuilder: null,
customErrorRetryBuilder: null,
customNormalStateBuilder: null,
customSwitcherBuilder: null,
);
}