Skip to content

Instantly share code, notes, and snippets.

@Metal-666
Created January 7, 2022 21:49
Show Gist options
  • Save Metal-666/b4c74fc21f4671f2e075a69f8236e817 to your computer and use it in GitHub Desktop.
Save Metal-666/b4c74fc21f4671f2e075a69f8236e817 to your computer and use it in GitHub Desktop.
Challenge 1
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) => const MaterialApp(
title: 'Challenge 1',
home: Home(),
);
}
class Home extends StatelessWidget {
const Home({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) => Scaffold(
body: Container(
color: Colors.indigo[100],
child: Column(
children: <Widget>[
const SizedBox(
height: 100,
child: Center(
child: Text(
'Lorem Ipsum Text',
style: TextStyle(fontSize: 22),
),
),
),
Expanded(
child: CustomPaint(
painter: CurvePainter(),
child: const Padding(
padding: EdgeInsets.only(
top: 50, left: 25, right: 25, bottom: 25),
child: SingleChildScrollView(
child: Text(
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Arcu ac tortor dignissim convallis aenean et tortor at risus. Elit pellentesque habitant morbi tristique senectus et netus et. Elementum tempus egestas sed sed. Venenatis urna cursus eget nunc scelerisque. Lacus luctus accumsan tortor posuere ac ut consequat. Justo donec enim diam vulputate ut. Ultricies leo integer malesuada nunc vel. Scelerisque felis imperdiet proin fermentum. Enim blandit volutpat maecenas volutpat blandit aliquam. Feugiat scelerisque varius morbi enim. Orci ac auctor augue mauris augue. Quis enim lobortis scelerisque fermentum dui. Morbi leo urna molestie at elementum eu facilisis sed. Urna nec tincidunt praesent semper feugiat nibh sed pulvinar. Erat pellentesque adipiscing commodo elit at. Massa massa ultricies mi quis. Urna condimentum mattis pellentesque id nibh tortor.\nScelerisque mauris pellentesque pulvinar pellentesque habitant morbi tristique senectus. Vel orci porta non pulvinar. Vulputate mi sit amet mauris commodo quis imperdiet. Vitae proin sagittis nisl rhoncus mattis rhoncus urna. Elit sed vulputate mi sit amet mauris commodo quis. Sed turpis tincidunt id aliquet risus feugiat in ante metus. Faucibus interdum posuere lorem ipsum dolor. Mollis nunc sed id semper risus in hendrerit gravida. Sapien et ligula ullamcorper malesuada proin. Urna cursus eget nunc scelerisque viverra. Id venenatis a condimentum vitae sapien pellentesque.\nUt aliquam purus sit amet. Convallis convallis tellus id interdum velit laoreet id donec ultrices. Viverra suspendisse potenti nullam ac. Odio morbi quis commodo odio aenean sed adipiscing. Aliquet bibendum enim facilisis gravida neque convallis a cras. Id diam vel quam elementum. Leo integer malesuada nunc vel risus commodo viverra. Auctor elit sed vulputate mi sit amet mauris commodo quis. Erat imperdiet sed euismod nisi porta lorem mollis. Eget egestas purus viverra accumsan in nisl. Sed enim ut sem viverra aliquet eget. Mi tempus imperdiet nulla malesuada. Dolor sit amet consectetur adipiscing elit ut aliquam purus. Augue lacus viverra vitae congue eu consequat. Pellentesque elit eget gravida cum sociis natoque penatibus et magnis. Et pharetra pharetra massa massa ultricies mi quis. Felis donec et odio pellentesque diam volutpat.',
style: TextStyle(fontSize: 14, color: Colors.white),
),
),
),
),
)
],
)),
);
}
class CurvePainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
Paint paint = Paint();
paint.color = Colors.deepPurple[700]!;
paint.style = PaintingStyle.fill;
Path path = Path();
path.quadraticBezierTo(
size.width * 0.25, size.height * -0.075, size.width * 0.5, 0);
path.quadraticBezierTo(
size.width * 0.75, size.height * 0.075, size.width * 1.0, 0);
path.lineTo(size.width, size.height);
path.lineTo(0, size.height);
canvas.drawPath(path, paint);
}
@override
bool shouldRepaint(CustomPainter oldDelegate) => true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment