@@ -37,54 +37,62 @@ class _ContentCardState extends State<ContentCard> {
3737
3838 @override
3939 Widget build (BuildContext context) {
40- var size = MediaQuery .of (context).size;
41- var time = DateTime .now ().millisecondsSinceEpoch / 2000 ;
42- var scaleX = 1.2 + sin (time) * .05 ;
43- var scaleY = 1.2 + cos (time) * .07 ;
44- var offsetY = 20 + cos (time) * 20 ;
45- return Stack (
46- alignment: Alignment .center,
47- fit: StackFit .expand,
48- children: < Widget > [
49- Transform (
50- transform: Matrix4 .diagonal3Values (scaleX, scaleY, 1 ),
51- child: Transform .translate (
52- offset: Offset (- (scaleX - 1 ) / 2 * size.width, - (scaleY - 1 ) / 2 * size.height + offsetY),
53- child: Image .asset ('images/Bg-${widget .color }.png' , fit: BoxFit .cover, package: App .pkg),
54- ),
55- ),
56- Container (
40+ return LayoutBuilder (
41+ builder: (_, constraints) {
42+ var time = DateTime .now ().millisecondsSinceEpoch / 2000 ;
43+ var scaleX = 1.2 + sin (time) * .05 ;
44+ var scaleY = 1.2 + cos (time) * .07 ;
45+ var offsetY = 20 + cos (time) * 20 ;
46+ final width = constraints.maxWidth;
47+ final height = constraints.maxHeight;
48+ return Stack (
5749 alignment: Alignment .center,
58- child: Padding (
59- padding: const EdgeInsets .only (top: 75.0 , bottom: 25.0 ),
60- child: Column (
61- children: < Widget > [
62- //Top Image
63- Expanded (
64- flex: 3 ,
65- child: Padding (
66- padding: const EdgeInsets .symmetric (horizontal: 20.0 ),
67- child:
68- Image .asset ('images/Illustration-${widget .color }.png' , fit: BoxFit .contain, package: App .pkg),
69- ),
70- ),
50+ fit: StackFit .expand,
51+ children: < Widget > [
52+ Transform .translate (
53+ offset: Offset (- (scaleX - 1 ) / 2 * width, - (scaleY - 1 ) / 2 * height + offsetY),
54+ child: Transform (
55+ transform: Matrix4 .diagonal3Values (scaleX, scaleY, 1 ),
56+ child: Image .asset ('images/Bg-${widget .color }.png' , fit: BoxFit .cover, package: App .pkg),
57+ ),
58+ ),
59+ Container (
60+ alignment: Alignment .center,
61+ child: Padding (
62+ padding: const EdgeInsets .only (top: 75.0 , bottom: 25.0 ),
63+ child: Column (
64+ children: < Widget > [
65+ //Top Image
66+ Expanded (
67+ flex: 3 ,
68+ child: Padding (
69+ padding: const EdgeInsets .symmetric (horizontal: 20.0 ),
70+ child: Image .asset (
71+ 'images/Illustration-${widget .color }.png' ,
72+ fit: BoxFit .contain,
73+ package: App .pkg,
74+ ),
75+ ),
76+ ),
7177
72- //Slider circles
73- Container (height: 14 , child: Image .asset ('images/Slider-${widget .color }.png' , package: App .pkg)),
78+ //Slider circles
79+ Container (height: 14 , child: Image .asset ('images/Slider-${widget .color }.png' , package: App .pkg)),
7480
75- //Bottom content
76- Expanded (
77- flex: 2 ,
78- child: Padding (
79- padding: const EdgeInsets .symmetric (horizontal: 18.0 ),
80- child: _buildBottomContent (),
81- ),
81+ //Bottom content
82+ Expanded (
83+ flex: 2 ,
84+ child: Padding (
85+ padding: const EdgeInsets .symmetric (horizontal: 18.0 ),
86+ child: _buildBottomContent (),
87+ ),
88+ ),
89+ ],
8290 ),
83- ] ,
84- ),
85- ) ,
86- )
87- ] ,
91+ ) ,
92+ )
93+ ] ,
94+ );
95+ } ,
8896 );
8997 }
9098
0 commit comments