Untitled
unknown
plain_text
4 years ago
6.9 kB
4
Indexable
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage();
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
bool _isDropped = false;
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Stack(
children: [
Container(child: Image.asset("assets/images/fgame.jpg")),
Padding(
padding: const EdgeInsets.only(top: 98.0),
child: Center(
child: GestureDetector(
onTap: () {
print('drawing tapped');
},
child: CustomPaint(
size: Size(MediaQuery.of(context).size.width, 400),
painter: C_Alphabet(),
),
),
),
)
],
),
)
// Stack(
// children: [
// Image.asset("assets/images/fgame.jpg"),
// Container(
// margin: const EdgeInsets.only(top: 100),
// child: Center(
// child: SizedBox(
// height: 300,
// width: 300,
// child: GestureDetector(
// onHorizontalDragStart: (DragStartDetails details) {
// print('start');
// print(details);
// },
// onHorizontalDragUpdate: (DragUpdateDetails details) {
// print('Update');
// print(details);
// },
// child: Stack(
// children: [
// Image.asset('assets/images/moon outline.png'),
// Draggable<String>(
// data: 'moon',
// child: Padding(
// padding: const EdgeInsets.only(left: 65.0),
// child: SvgPicture.asset(
// 'assets/images/Ellipse 1.svg',
// width: 45,
// color: Colors.orange,
// ),
// ),
// feedback: SvgPicture.asset(
// 'assets/images/Ellipse 1.svg',
// width: 45,
// color: Colors.black26,
// ),
// childWhenDragging: Container(),
// ),
// // DragTarget<String>(
// // builder: (
// // BuildContext context,
// // List<dynamic> accepted,
// // List<dynamic> rejected,
// // ) {
// // return Container(
// // child: Image.asset(_isDropped
// // ? 'assets/images/moon_02.png'
// // : 'assets/images/moon outline.png'),
// // );
// // },
// // onWillAccept: (data) {
// // return data == 'moon';
// // },
// // onAccept: (data) {
// // setState(() {
// // // showSnackBarGlobal(context, 'Dropped successfully!');
// // _isDropped = true;
// // });
// // },
// // ),
// ],
// ),
// ),
// ),
// ),
// ),
// ],
// )
);
}
}
class Alphabet extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
Paint paint0 = Paint()
..color = const Color.fromARGB(255, 19, 51, 75)
..style = PaintingStyle.fill
..strokeWidth = 5;
Path path0 = Path();
path0.moveTo(0, size.height);
path0.lineTo(size.width * 0.5000000, size.height * 0.1566667);
path0.lineTo(size.width, size.height);
path0.lineTo(size.width * 0.8366667, size.height);
path0.lineTo(size.width * 0.6633333, size.height * 0.6666667);
path0.lineTo(size.width * 0.3350000, size.height * 0.6666667);
path0.lineTo(size.width * 0.1666667, size.height);
path0.lineTo(0, size.height);
path0.close();
canvas.drawPath(path0, paint0);
}
@override
bool shouldRepaint(covariant CustomPainter oldDelegate) {
return true;
}
}
class C_Alphabet extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
Paint paint0 = Paint()
..color = const Color.fromARGB(155, 33, 267, 103)
..style = PaintingStyle.stroke
..strokeWidth = 5;
Path path0 = Path();
path0.moveTo(size.width * 0.6666667, size.height * 0.1666667);
path0.quadraticBezierTo(size.width * 0.1675000, size.height * 0.1650000,
size.width * 0.1633333, size.height * 0.4900000);
path0.quadraticBezierTo(size.width * 0.1641667, size.height * 0.8333333,
size.width * 0.6633333, size.height * 0.8333333);
path0.cubicTo(
size.width * 0.6641667,
size.height * 0.7825000,
size.width * 0.6658333,
size.height * 0.7083333,
size.width * 0.6666667,
size.height * 0.6666667);
path0.quadraticBezierTo(size.width * 0.3333333, size.height * 0.6641667,
size.width * 0.3333333, size.height * 0.4900000);
path0.quadraticBezierTo(size.width * 0.3341667, size.height * 0.3333333,
size.width * 0.6633333, size.height * 0.3333333);
path0.cubicTo(
size.width * 0.6641667,
// size.width * 0.664151567,
size.height * 0.2358333,
size.width * 0.6658333,
size.height * 0.1666667,
size.width * 0.6666667,
// size.width * 0.6666551145,
size.height * 0.1666667);
path0.close();
canvas.drawPath(path0, paint0);
}
@override
bool shouldRepaint(covariant CustomPainter oldDelegate) {
return true;
}
}
Editor is loading...