Created
February 2, 2024 08:39
-
-
Save piedcipher/c1bceffd806e16a7e2cd9cee2d86910c to your computer and use it in GitHub Desktop.
a tiny tale about an assert which broke my widget in Flutter 3.16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
const Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
void main() { | |
runApp(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
theme: ThemeData.dark().copyWith( | |
scaffoldBackgroundColor: darkBlue, | |
), | |
debugShowCheckedModeBanner: false, | |
home: const Scaffold( | |
body: MyWidget(), | |
), | |
); | |
} | |
} | |
class MyWidget extends StatelessWidget { | |
const MyWidget({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return Center( | |
child: SizedBox( | |
width: double.maxFinite, | |
child: DecoratedBox( | |
decoration: const BoxDecoration( | |
color: Colors.red, | |
borderRadius: BorderRadius.only( | |
bottomLeft: Radius.circular(20), | |
bottomRight: Radius.circular(20), | |
), | |
border: Border( | |
left: BorderSide( | |
width: 0.0, | |
color: Colors.black, | |
), | |
top: BorderSide( | |
width: 0.0, | |
color: Colors.black, | |
), | |
right: BorderSide( | |
width: 0.0, | |
color: Colors.black, | |
), | |
bottom: BorderSide( | |
width: 1, | |
color: Colors.black, | |
), | |
), | |
), | |
child: Padding( | |
padding: const EdgeInsets.all(8.0), | |
child: Row( | |
children: [ | |
const Spacer(), | |
DecoratedBox( | |
decoration: BoxDecoration( | |
color: Colors.black, | |
border: Border.all( | |
color: Colors.black, | |
width: 1.0, | |
), | |
borderRadius: const BorderRadius.all( | |
Radius.circular(20.0), | |
), | |
), | |
child: Padding( | |
padding: const EdgeInsets.all(8.0), | |
child: InkWell( | |
onTap: () {}, | |
child: const Text("FAQs"), | |
), | |
), | |
), | |
], | |
), | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment