I am using this progress dialog library to show progress UI when app is performing something serious IO stuff. But i noticed when we double tap or long press on any Text Input Field, App crashed / shows Red screen in debug.
Here is the related logs:
======== Exception caught by widgets library =======================================================
The following ArgumentError was thrown building _OverlayEntryWidget-[LabeledGlobalKey<_OverlayEntryWidgetState>#235b1](dirty, dependencies: [MediaQuery], state: _OverlayEntryWidgetState#faabb):
Invalid argument(s): 26.0
The relevant error-causing widget was:
ProgressDialog file:///Users/bipinvaylu/Documents/Work/Workspaces/xyzapp/lib/main.dart:89:24
When the exception was thrown, this was the stack:
#0 double.clamp (dart:core-patch/double.dart:183:7)
#1 _CupertinoTextSelectionControls.buildToolbar (package:flutter/src/cupertino/text_selection.dart:478:72)
#2 TextSelectionOverlay._buildToolbar (package:flutter/src/widgets/text_selection.dart:578:34)
#3 _OverlayEntryWidgetState.build (package:flutter/src/widgets/overlay.dart:179:34)
#4 StatefulElement.build (package:flutter/src/widgets/framework.dart:4744:28)
...
====================================================================================================
main.dart - MyApp:
class MyApp extends StatelessWidget {
MyApp();
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
]);
return Localizations(
locale: const Locale('en', 'US'),
delegates: <LocalizationsDelegate<dynamic>>[
DefaultWidgetsLocalizations.delegate,
DefaultMaterialLocalizations.delegate,
],
child: MediaQuery(
data: const MediaQueryData(),
child: ThemeBuilder(
defaultThemeMode: ThemeMode.system,
darkTheme: darkTheme,
lightTheme: lightTheme,
statusBarColorBuilder: (theme) => HomePage.tabBackgroundColor,
themes: getThemes(),
builder: (context, regularTheme, darkTheme, themeMode) {
return LayoutBuilder(
//return LayoutBuilder
builder: (context, constraints) {
return OrientationBuilder(
//return OrientationBuilder
builder: (context, orientation) {
//initialize SizerUtil()
SizerUtil().init(constraints, orientation);
return ProgressDialog(
orientation: ProgressOrientation.vertical,
loadingText: "Please wait...",
backgroundColor: Theme.of(context).backgroundColor,
child: MaterialApp(
title: "Xyz app",
theme: regularTheme,
darkTheme: darkTheme,
themeMode: themeMode,
home: SplashScreen(),
),
);
});
});
},
),
),
);
}
}
Text input field setup in other screen as follow:
Expanded(
child: CupertinoTextField(
controller: _userNameTextController,
keyboardType: TextInputType.name,
placeholder: "Friend username",
style: Theme.of(context).textTheme.bodyText1,
cursorColor: Theme.of(context).primaryColor,
prefix: Padding(
padding:
const EdgeInsets.fromLTRB(9.0, 6.0, 9.0, 6.0),
child: Icon(
Icons.search,
color: Theme.of(context).primaryColor,
),
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.0),
color: Theme.of(context).accentColor.withAlpha(70),
),
),
),
I don't see any proper solution as of now. Please help me here to resolve this issue. Else i might need try and switch over to other library and that some extra work. Thanks.