How to validate email in a TextFormField

You can use regex for this Form and TextFormField like so Form( autovalidateMode: AutovalidateMode.always, child: TextFormField( validator: validateEmail, ), ) then the validation function String? validateEmail(String? value) { const pattern = r”(?:[a-z0-9!#$%&’*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'” r’*+/=?^_`{|}~-]+)*|”(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-‘ r’\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*”)@(?:(?:[a-z0-9](?:[a-z0-9-]*’ r'[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4]’ r'[0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9]’ r'[0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\’ r’x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])’; final regex = RegExp(pattern); return value!.isNotEmpty && !regex.hasMatch(value) ? ‘Enter a valid email address’ : null; } … Read more

How to solve “A RenderFlex overflowed by 143 pixels on the right.” error in text?

Just Wrap you – Card with –Flexible Widget. Row( children: <Widget>[ Flexible( child: Card( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text(“Item name mmmasdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaammmmmm”), SizedBox(height: 15.0,), Text( “Discount mmmmmmmm”, ), SizedBox(height: 5.0,), Text( “Price ,mmmmmmmmmdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfmmmmmmmmm”, ) ], ), ), ), ], ),

Scroll through Flutter Bottom Sheet

I’ve found a solution implementing the code below void _showBottomSheet(BuildContext context) { showModalBottomSheet( context: context, isScrollControlled: true, backgroundColor: Colors.transparent, builder: (context) { return GestureDetector( onTap: () => Navigator.of(context).pop(), child: Container( color: Color.fromRGBO(0, 0, 0, 0.001), child: GestureDetector( onTap: () {}, child: DraggableScrollableSheet( initialChildSize: 0.4, minChildSize: 0.2, maxChildSize: 0.75, builder: (_, controller) { return Container( decoration: … Read more

Flutter Web: Cannot scroll with mouse down (drag) (Flutter 2.5+)

My final solution was a combination of the suggestions, wanting drag scrolling everywhere, so used this: class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( scrollBehavior: MaterialScrollBehavior().copyWith( dragDevices: {PointerDeviceKind.mouse, PointerDeviceKind.touch, PointerDeviceKind.stylus, PointerDeviceKind.unknown}, ), … Simple enough…

How to find memory leaks in Flutter?

I am implemented Memory leak testing in android studio ide. Step – 1 : Connect your device with android studio and run your application on your device. Step – 2 : Go to View -> Tool Windows -> Flutter Performance Step – 3 : Bottom of the window Open Dev Tools option will be there, … Read more

Flutter NotificationListener with ScrollNotification vs ScrollController

If you’re using NestedScrollView with nested scrollers, using a scrollController on the inner scrollers will break the link with NestedScrollView meaning NestedScrollView will no longer control the complete scrolling experience. To get information about the scroll positions of the inner scrollers in this case you would use a NotificationListener with ScrollNotification. NotificationListener<ScrollNotification>( child: ListView.builder( itemCount: … Read more

How to use generics and list of generics with json serialization in Dart?

json_serializable json_serializable has a several strategies1 to handle generic types as single objects T or List<T> (as of v. 5.0.2+) : Helper Class: JsonConverter Helper Methods: @JsonKey(fromJson:, toJson:) Generic Argument Factories @JsonSerializable(genericArgumentFactories: true) 1 Of which I’m aware. There’s likely other ways to do this. Helper Class: JsonConverter Basic idea: write a custom JsonConverter class … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)