Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
leynier committed Jul 20, 2020
1 parent acbb752 commit 178bf2e
Showing 1 changed file with 17 additions and 40 deletions.
57 changes: 17 additions & 40 deletions lib/src/widgets/info_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class InfoHeader extends StatefulWidget {
final String textTop;
final String textBottom;
final double offset;

const InfoHeader(
{Key key, this.image, this.textTop, this.textBottom, this.offset})
: super(key: key);
Expand All @@ -27,9 +28,7 @@ class _InfoHeaderState extends State<InfoHeader> {
return ClipPath(
clipper: DiagonalPathClipperOne(),
child: Container(
padding: EdgeInsets.only(left: 40, top: 5, right: 20),
height: 170,
width: double.infinity,
padding: EdgeInsets.only(left: 20, top: 5, right: 30),
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
Expand All @@ -43,56 +42,34 @@ class _InfoHeaderState extends State<InfoHeader> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
SizedBox(height: 20),
Expanded(
child: Stack(
children: <Widget>[
Positioned(
top: (widget.offset < 0) ? 0 : widget.offset,
child: SvgPicture.asset(
widget.image,
width: 135,
fit: BoxFit.fitWidth,
alignment: Alignment.topCenter,
),
Row(
children: <Widget>[
Container(
child: SvgPicture.asset(
widget.image,
width: 135,
fit: BoxFit.fitWidth,
alignment: Alignment.topCenter,
),
Positioned(
top: 20 - widget.offset / 2,
left: 140,
width: 160.0,
),
Expanded(
child: Container(
margin: EdgeInsets.only(bottom: 10),
child: Text(
"${widget.textTop}\n${widget.textBottom}",
style: Constants.kHeadingTextStyle.copyWith(
color: Colors.white,
fontSize: 18,
),
textAlign: TextAlign.end,
),
),
Container(), // I dont know why it can't work without container
],
),
),
],
),
],
),
),
);
}
}

class MyClipper extends CustomClipper<Path> {
@override
Path getClip(Size size) {
var path = Path();
path.lineTo(0, size.height - 80);
path.quadraticBezierTo(
size.width / 2, size.height, size.width, size.height - 80);
path.lineTo(size.width, 0);
path.close();
return path;
}

@override
bool shouldReclip(CustomClipper<Path> oldClipper) {
return false;
}
}

0 comments on commit 178bf2e

Please sign in to comment.