Skip to content

Instantly share code, notes, and snippets.

@CMingTseng
Created December 6, 2021 04:13
Show Gist options
  • Save CMingTseng/aa9b1677f284cb4425367d39b5d61d4f to your computer and use it in GitHub Desktop.
Save CMingTseng/aa9b1677f284cb4425367d39b5d61d4f to your computer and use it in GitHub Desktop.
// Note !!
// How Wrap_content ? let size match child height ?
// now not work help me fix it
//Ref : https://stackoverflow.com/questions/50713888/how-to-show-image-from-network-in-flutter-boxdecoration
// https://blog.csdn.net/qq_24531461/article/details/85541613
// Yes i do not want set height or Width or "Width & height "
class UrbanCongratulationsWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return FittedBox(
child: Container(
// how remove BoxConstraints ?
// constraints: BoxConstraints(
// minHeight: 100,
// maxHeight: 100,
// minWidth: MediaQuery.of(context).size.width,
// maxWidth: MediaQuery.of(context).size.width,
// ),
alignment: FractionalOffset(0.5, 0.5),
padding: EdgeInsets.fromLTRB(32, 0, 0, 0),
decoration: BoxDecoration(
// color: Colors.yellow,
color: Color(0x00000000),
image: DecorationImage(
image:NetworkImage("https://purepng.com/public/uploads/large/purepng.com-mariomariofictional-charactervideo-gamefranchisenintendodesigner-1701528634653vywuz.png"),
fit: BoxFit.cover
)
),
child:AutoSizeText( '恭喜你過關',
textAlign: TextAlign.center,
maxFontSize: 22,
maxLines: 1,
style: TextStyle(
fontSize: 20,
color: Colors.white, ))
);
}
class ControllerDemoPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
"ControllerDemoPage",
),
),
body: UrbanCongratulationsWidget());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment