repo_id
stringlengths
21
168
file_path
stringlengths
36
210
content
stringlengths
1
9.98M
__index_level_0__
int64
0
0
mirrored_repositories/flutter_mockup_bloc/lib/utils/ui
mirrored_repositories/flutter_mockup_bloc/lib/utils/ui/drawer/lock_icon_painter.dart
// ignore_for_file: non_constant_identifier_names import 'package:flutter/material.dart'; class LockIconPainter extends CustomPainter { const LockIconPainter(); @override void paint(Canvas canvas, Size size) { Path path_0 = Path(); path_0.moveTo(size.width * 0.6666667, size.height * 0.3333333); path_0.lineTo(size.width * 0.6666667, size.height * 0.2916667); path_0.cubicTo( size.width * 0.6666667, size.height * 0.1996192, size.width * 0.5920458, size.height * 0.1250000, size.width * 0.5000000, size.height * 0.1250000); path_0.cubicTo( size.width * 0.4079525, size.height * 0.1250000, size.width * 0.3333333, size.height * 0.1996192, size.width * 0.3333333, size.height * 0.2916667); path_0.lineTo(size.width * 0.3333333, size.height * 0.3333333); Paint paint_0_stroke = Paint() ..style = PaintingStyle.stroke ..strokeWidth = size.width * 0.08333333; paint_0_stroke.color = Color(0xff4C5BD4).withOpacity(1.0); paint_0_stroke.strokeCap = StrokeCap.round; canvas.drawPath(path_0, paint_0_stroke); Path path_1 = Path(); path_1.moveTo(size.width * 0.1616117, size.height * 0.3282783); path_1.cubicTo( size.width * 0.1250000, size.height * 0.3648900, size.width * 0.1250000, size.height * 0.4238167, size.width * 0.1250000, size.height * 0.5416667); path_1.lineTo(size.width * 0.1250000, size.height * 0.5833333); path_1.cubicTo( size.width * 0.1250000, size.height * 0.7404667, size.width * 0.1250000, size.height * 0.8190375, size.width * 0.1738154, size.height * 0.8678500); path_1.cubicTo( size.width * 0.2226312, size.height * 0.9166667, size.width * 0.3011983, size.height * 0.9166667, size.width * 0.4583333, size.height * 0.9166667); path_1.lineTo(size.width * 0.5416667, size.height * 0.9166667); path_1.cubicTo( size.width * 0.6988000, size.height * 0.9166667, size.width * 0.7773708, size.height * 0.9166667, size.width * 0.8261833, size.height * 0.8678500); path_1.cubicTo( size.width * 0.8750000, size.height * 0.8190375, size.width * 0.8750000, size.height * 0.7404667, size.width * 0.8750000, size.height * 0.5833333); path_1.lineTo(size.width * 0.8750000, size.height * 0.5416667); path_1.cubicTo( size.width * 0.8750000, size.height * 0.4238167, size.width * 0.8750000, size.height * 0.3648900, size.width * 0.8383875, size.height * 0.3282783); path_1.cubicTo( size.width * 0.8017750, size.height * 0.2916667, size.width * 0.7428500, size.height * 0.2916667, size.width * 0.6250000, size.height * 0.2916667); path_1.lineTo(size.width * 0.3750000, size.height * 0.2916667); path_1.cubicTo( size.width * 0.2571487, size.height * 0.2916667, size.width * 0.1982233, size.height * 0.2916667, size.width * 0.1616117, size.height * 0.3282783); path_1.close(); path_1.moveTo(size.width * 0.5000000, size.height * 0.6250000); path_1.cubicTo( size.width * 0.5230125, size.height * 0.6250000, size.width * 0.5416667, size.height * 0.6063458, size.width * 0.5416667, size.height * 0.5833333); path_1.cubicTo( size.width * 0.5416667, size.height * 0.5603208, size.width * 0.5230125, size.height * 0.5416667, size.width * 0.5000000, size.height * 0.5416667); path_1.cubicTo( size.width * 0.4769875, size.height * 0.5416667, size.width * 0.4583333, size.height * 0.5603208, size.width * 0.4583333, size.height * 0.5833333); path_1.cubicTo( size.width * 0.4583333, size.height * 0.6063458, size.width * 0.4769875, size.height * 0.6250000, size.width * 0.5000000, size.height * 0.6250000); path_1.close(); path_1.moveTo(size.width * 0.6250000, size.height * 0.5833333); path_1.cubicTo( size.width * 0.6250000, size.height * 0.6377583, size.width * 0.5902167, size.height * 0.6840625, size.width * 0.5416667, size.height * 0.7012208); path_1.lineTo(size.width * 0.5416667, size.height * 0.7916667); path_1.lineTo(size.width * 0.4583333, size.height * 0.7916667); path_1.lineTo(size.width * 0.4583333, size.height * 0.7012208); path_1.cubicTo( size.width * 0.4097837, size.height * 0.6840625, size.width * 0.3750000, size.height * 0.6377583, size.width * 0.3750000, size.height * 0.5833333); path_1.cubicTo( size.width * 0.3750000, size.height * 0.5142958, size.width * 0.4309625, size.height * 0.4583333, size.width * 0.5000000, size.height * 0.4583333); path_1.cubicTo( size.width * 0.5690375, size.height * 0.4583333, size.width * 0.6250000, size.height * 0.5142958, size.width * 0.6250000, size.height * 0.5833333); path_1.close(); Paint paint_1_fill = Paint()..style = PaintingStyle.fill; paint_1_fill.color = Color(0xff4C5BD4).withOpacity(1.0); canvas.drawPath(path_1, paint_1_fill); } @override bool shouldRepaint(covariant CustomPainter oldDelegate) => false; }
0
mirrored_repositories/flutter_mockup_bloc/lib/utils/ui
mirrored_repositories/flutter_mockup_bloc/lib/utils/ui/drawer/books_icon_painter.dart
// ignore_for_file: non_constant_identifier_names import 'package:flutter/material.dart'; class BooksIconPainter extends CustomPainter { const BooksIconPainter(); @override void paint(Canvas canvas, Size size) { Path path_0 = Path(); path_0.moveTo(size.width * 0.3750000, size.height * 0.04166667); path_0.cubicTo( size.width * 0.2599408, size.height * 0.04166667, size.width * 0.1666667, size.height * 0.1349408, size.width * 0.1666667, size.height * 0.2500000); path_0.cubicTo( size.width * 0.1666667, size.height * 0.3650592, size.width * 0.2599408, size.height * 0.4583333, size.width * 0.3750000, size.height * 0.4583333); path_0.lineTo(size.width * 0.9375000, size.height * 0.4583333); path_0.cubicTo( size.width * 0.9490042, size.height * 0.4583333, size.width * 0.9583333, size.height * 0.4490042, size.width * 0.9583333, size.height * 0.4375000); path_0.cubicTo( size.width * 0.9583333, size.height * 0.4259958, size.width * 0.9490042, size.height * 0.4166667, size.width * 0.9375000, size.height * 0.4166667); path_0.lineTo(size.width * 0.3750000, size.height * 0.4166667); path_0.cubicTo( size.width * 0.2829525, size.height * 0.4166667, size.width * 0.2083333, size.height * 0.3420475, size.width * 0.2083333, size.height * 0.2500000); path_0.cubicTo( size.width * 0.2083333, size.height * 0.1579525, size.width * 0.2829525, size.height * 0.08333333, size.width * 0.3750000, size.height * 0.08333333); path_0.lineTo(size.width * 0.9375000, size.height * 0.08333333); path_0.cubicTo( size.width * 0.9490042, size.height * 0.08333333, size.width * 0.9583333, size.height * 0.07400583, size.width * 0.9583333, size.height * 0.06250000); path_0.cubicTo( size.width * 0.9583333, size.height * 0.05099417, size.width * 0.9490042, size.height * 0.04166667, size.width * 0.9375000, size.height * 0.04166667); path_0.lineTo(size.width * 0.3750000, size.height * 0.04166667); path_0.close(); Paint paint_0_fill = Paint()..style = PaintingStyle.fill; paint_0_fill.color = Color(0xff4C5BD4).withOpacity(1.0); canvas.drawPath(path_0, paint_0_fill); Path path_1 = Path(); path_1.moveTo(size.width * 0.1770833, size.height * 0.2500000); path_1.cubicTo( size.width * 0.1770833, size.height * 0.1406938, size.width * 0.2656938, size.height * 0.05208333, size.width * 0.3750000, size.height * 0.05208333); path_1.lineTo(size.width * 0.3750000, size.height * 0.03125000); path_1.cubicTo( size.width * 0.2541879, size.height * 0.03125000, size.width * 0.1562500, size.height * 0.1291879, size.width * 0.1562500, size.height * 0.2500000); path_1.lineTo(size.width * 0.1770833, size.height * 0.2500000); path_1.close(); path_1.moveTo(size.width * 0.3750000, size.height * 0.4479167); path_1.cubicTo( size.width * 0.2656938, size.height * 0.4479167, size.width * 0.1770833, size.height * 0.3593062, size.width * 0.1770833, size.height * 0.2500000); path_1.lineTo(size.width * 0.1562500, size.height * 0.2500000); path_1.cubicTo( size.width * 0.1562500, size.height * 0.3708121, size.width * 0.2541879, size.height * 0.4687500, size.width * 0.3750000, size.height * 0.4687500); path_1.lineTo(size.width * 0.3750000, size.height * 0.4479167); path_1.close(); path_1.moveTo(size.width * 0.9375000, size.height * 0.4479167); path_1.lineTo(size.width * 0.3750000, size.height * 0.4479167); path_1.lineTo(size.width * 0.3750000, size.height * 0.4687500); path_1.lineTo(size.width * 0.9375000, size.height * 0.4687500); path_1.lineTo(size.width * 0.9375000, size.height * 0.4479167); path_1.close(); path_1.moveTo(size.width * 0.9375000, size.height * 0.4062500); path_1.lineTo(size.width * 0.3750000, size.height * 0.4062500); path_1.lineTo(size.width * 0.3750000, size.height * 0.4270833); path_1.lineTo(size.width * 0.9375000, size.height * 0.4270833); path_1.lineTo(size.width * 0.9375000, size.height * 0.4062500); path_1.close(); path_1.moveTo(size.width * 0.3750000, size.height * 0.4062500); path_1.cubicTo( size.width * 0.2887054, size.height * 0.4062500, size.width * 0.2187500, size.height * 0.3362946, size.width * 0.2187500, size.height * 0.2500000); path_1.lineTo(size.width * 0.1979167, size.height * 0.2500000); path_1.cubicTo( size.width * 0.1979167, size.height * 0.3478004, size.width * 0.2771996, size.height * 0.4270833, size.width * 0.3750000, size.height * 0.4270833); path_1.lineTo(size.width * 0.3750000, size.height * 0.4062500); path_1.close(); path_1.moveTo(size.width * 0.2187500, size.height * 0.2500000); path_1.cubicTo( size.width * 0.2187500, size.height * 0.1637054, size.width * 0.2887054, size.height * 0.09375000, size.width * 0.3750000, size.height * 0.09375000); path_1.lineTo(size.width * 0.3750000, size.height * 0.07291667); path_1.cubicTo( size.width * 0.2771996, size.height * 0.07291667, size.width * 0.1979167, size.height * 0.1521996, size.width * 0.1979167, size.height * 0.2500000); path_1.lineTo(size.width * 0.2187500, size.height * 0.2500000); path_1.close(); path_1.moveTo(size.width * 0.3750000, size.height * 0.09375000); path_1.lineTo(size.width * 0.9375000, size.height * 0.09375000); path_1.lineTo(size.width * 0.9375000, size.height * 0.07291667); path_1.lineTo(size.width * 0.3750000, size.height * 0.07291667); path_1.lineTo(size.width * 0.3750000, size.height * 0.09375000); path_1.close(); path_1.moveTo(size.width * 0.3750000, size.height * 0.05208333); path_1.lineTo(size.width * 0.9375000, size.height * 0.05208333); path_1.lineTo(size.width * 0.9375000, size.height * 0.03125000); path_1.lineTo(size.width * 0.3750000, size.height * 0.03125000); path_1.lineTo(size.width * 0.3750000, size.height * 0.05208333); path_1.close(); path_1.moveTo(size.width * 0.9687500, size.height * 0.06250000); path_1.cubicTo( size.width * 0.9687500, size.height * 0.04524125, size.width * 0.9547583, size.height * 0.03125000, size.width * 0.9375000, size.height * 0.03125000); path_1.lineTo(size.width * 0.9375000, size.height * 0.05208333); path_1.cubicTo( size.width * 0.9432542, size.height * 0.05208333, size.width * 0.9479167, size.height * 0.05674708, size.width * 0.9479167, size.height * 0.06250000); path_1.lineTo(size.width * 0.9687500, size.height * 0.06250000); path_1.close(); path_1.moveTo(size.width * 0.9687500, size.height * 0.4375000); path_1.cubicTo( size.width * 0.9687500, size.height * 0.4202417, size.width * 0.9547583, size.height * 0.4062500, size.width * 0.9375000, size.height * 0.4062500); path_1.lineTo(size.width * 0.9375000, size.height * 0.4270833); path_1.cubicTo( size.width * 0.9432542, size.height * 0.4270833, size.width * 0.9479167, size.height * 0.4317458, size.width * 0.9479167, size.height * 0.4375000); path_1.lineTo(size.width * 0.9687500, size.height * 0.4375000); path_1.close(); path_1.moveTo(size.width * 0.9375000, size.height * 0.09375000); path_1.cubicTo( size.width * 0.9547583, size.height * 0.09375000, size.width * 0.9687500, size.height * 0.07975875, size.width * 0.9687500, size.height * 0.06250000); path_1.lineTo(size.width * 0.9479167, size.height * 0.06250000); path_1.cubicTo( size.width * 0.9479167, size.height * 0.06825292, size.width * 0.9432542, size.height * 0.07291667, size.width * 0.9375000, size.height * 0.07291667); path_1.lineTo(size.width * 0.9375000, size.height * 0.09375000); path_1.close(); path_1.moveTo(size.width * 0.9375000, size.height * 0.4687500); path_1.cubicTo( size.width * 0.9547583, size.height * 0.4687500, size.width * 0.9687500, size.height * 0.4547583, size.width * 0.9687500, size.height * 0.4375000); path_1.lineTo(size.width * 0.9479167, size.height * 0.4375000); path_1.cubicTo( size.width * 0.9479167, size.height * 0.4432542, size.width * 0.9432542, size.height * 0.4479167, size.width * 0.9375000, size.height * 0.4479167); path_1.lineTo(size.width * 0.9375000, size.height * 0.4687500); path_1.close(); Paint paint_1_fill = Paint()..style = PaintingStyle.fill; paint_1_fill.color = Color(0xff4C5BD4).withOpacity(1.0); canvas.drawPath(path_1, paint_1_fill); Path path_2 = Path(); path_2.moveTo(size.width * 0.6250000, size.height * 0.9166667); path_2.cubicTo( size.width * 0.7400583, size.height * 0.9166667, size.width * 0.8333333, size.height * 0.8233917, size.width * 0.8333333, size.height * 0.7083333); path_2.cubicTo( size.width * 0.8333333, size.height * 0.5932750, size.width * 0.7400583, size.height * 0.5000000, size.width * 0.6250000, size.height * 0.5000000); path_2.lineTo(size.width * 0.06250000, size.height * 0.5000000); path_2.cubicTo( size.width * 0.05099417, size.height * 0.5000000, size.width * 0.04166667, size.height * 0.5093292, size.width * 0.04166667, size.height * 0.5208333); path_2.cubicTo( size.width * 0.04166667, size.height * 0.5323375, size.width * 0.05099417, size.height * 0.5416667, size.width * 0.06250000, size.height * 0.5416667); path_2.lineTo(size.width * 0.6250000, size.height * 0.5416667); path_2.cubicTo( size.width * 0.7170458, size.height * 0.5416667, size.width * 0.7916667, size.height * 0.6162875, size.width * 0.7916667, size.height * 0.7083333); path_2.cubicTo( size.width * 0.7916667, size.height * 0.8003792, size.width * 0.7170458, size.height * 0.8750000, size.width * 0.6250000, size.height * 0.8750000); path_2.lineTo(size.width * 0.06250000, size.height * 0.8750000); path_2.cubicTo( size.width * 0.05099417, size.height * 0.8750000, size.width * 0.04166667, size.height * 0.8843292, size.width * 0.04166667, size.height * 0.8958333); path_2.cubicTo( size.width * 0.04166667, size.height * 0.9073375, size.width * 0.05099417, size.height * 0.9166667, size.width * 0.06250000, size.height * 0.9166667); path_2.lineTo(size.width * 0.6250000, size.height * 0.9166667); path_2.close(); Paint paint_2_fill = Paint()..style = PaintingStyle.fill; paint_2_fill.color = Color(0xff4C5BD4).withOpacity(1.0); canvas.drawPath(path_2, paint_2_fill); Path path_3 = Path(); path_3.moveTo(size.width * 0.8229167, size.height * 0.7083333); path_3.cubicTo( size.width * 0.8229167, size.height * 0.8176417, size.width * 0.7343083, size.height * 0.9062500, size.width * 0.6250000, size.height * 0.9062500); path_3.lineTo(size.width * 0.6250000, size.height * 0.9270833); path_3.cubicTo( size.width * 0.7458125, size.height * 0.9270833, size.width * 0.8437500, size.height * 0.8291458, size.width * 0.8437500, size.height * 0.7083333); path_3.lineTo(size.width * 0.8229167, size.height * 0.7083333); path_3.close(); path_3.moveTo(size.width * 0.6250000, size.height * 0.5104167); path_3.cubicTo( size.width * 0.7343083, size.height * 0.5104167, size.width * 0.8229167, size.height * 0.5990250, size.width * 0.8229167, size.height * 0.7083333); path_3.lineTo(size.width * 0.8437500, size.height * 0.7083333); path_3.cubicTo( size.width * 0.8437500, size.height * 0.5875208, size.width * 0.7458125, size.height * 0.4895833, size.width * 0.6250000, size.height * 0.4895833); path_3.lineTo(size.width * 0.6250000, size.height * 0.5104167); path_3.close(); path_3.moveTo(size.width * 0.06250000, size.height * 0.5104167); path_3.lineTo(size.width * 0.6250000, size.height * 0.5104167); path_3.lineTo(size.width * 0.6250000, size.height * 0.4895833); path_3.lineTo(size.width * 0.06250000, size.height * 0.4895833); path_3.lineTo(size.width * 0.06250000, size.height * 0.5104167); path_3.close(); path_3.moveTo(size.width * 0.06250000, size.height * 0.5520833); path_3.lineTo(size.width * 0.6250000, size.height * 0.5520833); path_3.lineTo(size.width * 0.6250000, size.height * 0.5312500); path_3.lineTo(size.width * 0.06250000, size.height * 0.5312500); path_3.lineTo(size.width * 0.06250000, size.height * 0.5520833); path_3.close(); path_3.moveTo(size.width * 0.6250000, size.height * 0.5520833); path_3.cubicTo( size.width * 0.7112958, size.height * 0.5520833, size.width * 0.7812500, size.height * 0.6220375, size.width * 0.7812500, size.height * 0.7083333); path_3.lineTo(size.width * 0.8020833, size.height * 0.7083333); path_3.cubicTo( size.width * 0.8020833, size.height * 0.6105333, size.width * 0.7228000, size.height * 0.5312500, size.width * 0.6250000, size.height * 0.5312500); path_3.lineTo(size.width * 0.6250000, size.height * 0.5520833); path_3.close(); path_3.moveTo(size.width * 0.7812500, size.height * 0.7083333); path_3.cubicTo( size.width * 0.7812500, size.height * 0.7946292, size.width * 0.7112958, size.height * 0.8645833, size.width * 0.6250000, size.height * 0.8645833); path_3.lineTo(size.width * 0.6250000, size.height * 0.8854167); path_3.cubicTo( size.width * 0.7228000, size.height * 0.8854167, size.width * 0.8020833, size.height * 0.8061333, size.width * 0.8020833, size.height * 0.7083333); path_3.lineTo(size.width * 0.7812500, size.height * 0.7083333); path_3.close(); path_3.moveTo(size.width * 0.6250000, size.height * 0.8645833); path_3.lineTo(size.width * 0.06250000, size.height * 0.8645833); path_3.lineTo(size.width * 0.06250000, size.height * 0.8854167); path_3.lineTo(size.width * 0.6250000, size.height * 0.8854167); path_3.lineTo(size.width * 0.6250000, size.height * 0.8645833); path_3.close(); path_3.moveTo(size.width * 0.6250000, size.height * 0.9062500); path_3.lineTo(size.width * 0.06250000, size.height * 0.9062500); path_3.lineTo(size.width * 0.06250000, size.height * 0.9270833); path_3.lineTo(size.width * 0.6250000, size.height * 0.9270833); path_3.lineTo(size.width * 0.6250000, size.height * 0.9062500); path_3.close(); path_3.moveTo(size.width * 0.03125000, size.height * 0.8958333); path_3.cubicTo( size.width * 0.03125000, size.height * 0.9130917, size.width * 0.04524125, size.height * 0.9270833, size.width * 0.06250000, size.height * 0.9270833); path_3.lineTo(size.width * 0.06250000, size.height * 0.9062500); path_3.cubicTo( size.width * 0.05674708, size.height * 0.9062500, size.width * 0.05208333, size.height * 0.9015875, size.width * 0.05208333, size.height * 0.8958333); path_3.lineTo(size.width * 0.03125000, size.height * 0.8958333); path_3.close(); path_3.moveTo(size.width * 0.03125004, size.height * 0.5208333); path_3.cubicTo( size.width * 0.03125004, size.height * 0.5380917, size.width * 0.04524125, size.height * 0.5520833, size.width * 0.06250000, size.height * 0.5520833); path_3.lineTo(size.width * 0.06250000, size.height * 0.5312500); path_3.cubicTo( size.width * 0.05674708, size.height * 0.5312500, size.width * 0.05208333, size.height * 0.5265875, size.width * 0.05208333, size.height * 0.5208333); path_3.lineTo(size.width * 0.03125004, size.height * 0.5208333); path_3.close(); path_3.moveTo(size.width * 0.06250000, size.height * 0.8645833); path_3.cubicTo( size.width * 0.04524125, size.height * 0.8645833, size.width * 0.03125000, size.height * 0.8785750, size.width * 0.03125000, size.height * 0.8958333); path_3.lineTo(size.width * 0.05208333, size.height * 0.8958333); path_3.cubicTo( size.width * 0.05208333, size.height * 0.8900792, size.width * 0.05674708, size.height * 0.8854167, size.width * 0.06250000, size.height * 0.8854167); path_3.lineTo(size.width * 0.06250000, size.height * 0.8645833); path_3.close(); path_3.moveTo(size.width * 0.06250000, size.height * 0.4895833); path_3.cubicTo( size.width * 0.04524125, size.height * 0.4895833, size.width * 0.03125004, size.height * 0.5035750, size.width * 0.03125004, size.height * 0.5208333); path_3.lineTo(size.width * 0.05208333, size.height * 0.5208333); path_3.cubicTo( size.width * 0.05208333, size.height * 0.5150792, size.width * 0.05674708, size.height * 0.5104167, size.width * 0.06250000, size.height * 0.5104167); path_3.lineTo(size.width * 0.06250000, size.height * 0.4895833); path_3.close(); Paint paint_3_fill = Paint()..style = PaintingStyle.fill; paint_3_fill.color = Color(0xff4C5BD4).withOpacity(1.0); canvas.drawPath(path_3, paint_3_fill); Path path_4 = Path(); path_4.moveTo(size.width * 0.2500000, size.height * 0.2500000); path_4.cubicTo( size.width * 0.2500000, size.height * 0.1809646, size.width * 0.3059646, size.height * 0.1250000, size.width * 0.3750000, size.height * 0.1250000); path_4.lineTo(size.width * 0.8750000, size.height * 0.1250000); path_4.lineTo(size.width * 0.8750000, size.height * 0.3750000); path_4.lineTo(size.width * 0.3750000, size.height * 0.3750000); path_4.cubicTo( size.width * 0.3059646, size.height * 0.3750000, size.width * 0.2500000, size.height * 0.3190354, size.width * 0.2500000, size.height * 0.2500000); path_4.close(); Paint paint_4_fill = Paint()..style = PaintingStyle.fill; paint_4_fill.color = Color(0xff4C5BD4).withOpacity(1.0); canvas.drawPath(path_4, paint_4_fill); Path path_5 = Path(); path_5.moveTo(size.width * 0.7500000, size.height * 0.7083333); path_5.cubicTo( size.width * 0.7500000, size.height * 0.7773708, size.width * 0.6940375, size.height * 0.8333333, size.width * 0.6250000, size.height * 0.8333333); path_5.lineTo(size.width * 0.1250000, size.height * 0.8333333); path_5.lineTo(size.width * 0.1250000, size.height * 0.5833333); path_5.lineTo(size.width * 0.6250000, size.height * 0.5833333); path_5.cubicTo( size.width * 0.6940375, size.height * 0.5833333, size.width * 0.7500000, size.height * 0.6392958, size.width * 0.7500000, size.height * 0.7083333); path_5.close(); Paint paint_5_fill = Paint()..style = PaintingStyle.fill; paint_5_fill.color = Color(0xff4C5BD4).withOpacity(1.0); canvas.drawPath(path_5, paint_5_fill); Paint paint_6_fill = Paint()..style = PaintingStyle.fill; paint_6_fill.color = Colors.white.withOpacity(1.0); canvas.drawRRect( RRect.fromRectAndCorners( Rect.fromLTWH(size.width * 0.3333333, size.height * 0.1666667, size.width * 0.4583333, size.height * 0.03333333), bottomRight: Radius.circular(size.width * 0.01666667), bottomLeft: Radius.circular(size.width * 0.01666667), topLeft: Radius.circular(size.width * 0.01666667), topRight: Radius.circular(size.width * 0.01666667)), paint_6_fill); Paint paint_7_fill = Paint()..style = PaintingStyle.fill; paint_7_fill.color = Colors.white.withOpacity(1.0); canvas.drawRRect( RRect.fromRectAndCorners( Rect.fromLTWH(size.width * 0.3333333, size.height * 0.2333375, size.width * 0.4583333, size.height * 0.03333333), bottomRight: Radius.circular(size.width * 0.01666667), bottomLeft: Radius.circular(size.width * 0.01666667), topLeft: Radius.circular(size.width * 0.01666667), topRight: Radius.circular(size.width * 0.01666667)), paint_7_fill); Paint paint_8_fill = Paint()..style = PaintingStyle.fill; paint_8_fill.color = Colors.white.withOpacity(1.0); canvas.drawRRect( RRect.fromRectAndCorners( Rect.fromLTWH(size.width * 0.3333333, size.height * 0.3000083, size.width * 0.4583333, size.height * 0.03333333), bottomRight: Radius.circular(size.width * 0.01666667), bottomLeft: Radius.circular(size.width * 0.01666667), topLeft: Radius.circular(size.width * 0.01666667), topRight: Radius.circular(size.width * 0.01666667)), paint_8_fill); Paint paint_9_fill = Paint()..style = PaintingStyle.fill; paint_9_fill.color = Colors.white.withOpacity(1.0); canvas.drawRRect( RRect.fromRectAndCorners( Rect.fromLTWH(size.width * 0.2083333, size.height * 0.6250000, size.width * 0.4583333, size.height * 0.03333333), bottomRight: Radius.circular(size.width * 0.01666667), bottomLeft: Radius.circular(size.width * 0.01666667), topLeft: Radius.circular(size.width * 0.01666667), topRight: Radius.circular(size.width * 0.01666667)), paint_9_fill); Paint paint_10_fill = Paint()..style = PaintingStyle.fill; paint_10_fill.color = Colors.white.withOpacity(1.0); canvas.drawRRect( RRect.fromRectAndCorners( Rect.fromLTWH(size.width * 0.2083333, size.height * 0.6916708, size.width * 0.4583333, size.height * 0.03333333), bottomRight: Radius.circular(size.width * 0.01666667), bottomLeft: Radius.circular(size.width * 0.01666667), topLeft: Radius.circular(size.width * 0.01666667), topRight: Radius.circular(size.width * 0.01666667)), paint_10_fill); Paint paint_11_fill = Paint()..style = PaintingStyle.fill; paint_11_fill.color = Colors.white.withOpacity(1.0); canvas.drawRRect( RRect.fromRectAndCorners( Rect.fromLTWH(size.width * 0.2083333, size.height * 0.7583417, size.width * 0.4583333, size.height * 0.03333333), bottomRight: Radius.circular(size.width * 0.01666667), bottomLeft: Radius.circular(size.width * 0.01666667), topLeft: Radius.circular(size.width * 0.01666667), topRight: Radius.circular(size.width * 0.01666667)), paint_11_fill); } @override bool shouldRepaint(covariant CustomPainter oldDelegate) => false; }
0
mirrored_repositories/flutter_mockup_bloc/lib/utils/ui
mirrored_repositories/flutter_mockup_bloc/lib/utils/ui/drawer/motel_icon_painter.dart
// ignore_for_file: non_constant_identifier_names import 'package:flutter/material.dart'; class MotelIconPainter extends CustomPainter { const MotelIconPainter(); @override void paint(Canvas canvas, Size size) { Path path_0 = Path(); path_0.moveTo(size.width * 0.3214112, size.height * 0.9999917); path_0.lineTo(size.width * 0.4285500, size.height * 0.9999917); path_0.lineTo(size.width * 0.4285500, size.height * 0.8035667); path_0.lineTo(size.width * 0.3214112, size.height * 0.8035667); path_0.lineTo(size.width * 0.3214112, size.height * 0.9999917); path_0.close(); path_0.moveTo(size.width * 0.3928379, size.height * 0.8928542); path_0.cubicTo( size.width * 0.4026996, size.height * 0.8928542, size.width * 0.4106946, size.height * 0.9008458, size.width * 0.4106946, size.height * 0.9107083); path_0.cubicTo( size.width * 0.4106946, size.height * 0.9205708, size.width * 0.4026996, size.height * 0.9285667, size.width * 0.3928379, size.height * 0.9285667); path_0.cubicTo( size.width * 0.3829763, size.height * 0.9285667, size.width * 0.3749812, size.height * 0.9205708, size.width * 0.3749812, size.height * 0.9107083); path_0.cubicTo( size.width * 0.3749812, size.height * 0.9008458, size.width * 0.3829763, size.height * 0.8928542, size.width * 0.3928379, size.height * 0.8928542); path_0.close(); Paint paint_0_fill = Paint()..style = PaintingStyle.fill; paint_0_fill.color = Color(0xff4C5BD4).withOpacity(1.0); canvas.drawPath(path_0, paint_0_fill); Path path_1 = Path(); path_1.moveTo(size.width * 0.7500000, size.height * 0.6071292); path_1.lineTo(size.width * 0.8571417, size.height * 0.6071292); path_1.lineTo(size.width * 0.8571417, size.height * 0.4107054); path_1.lineTo(size.width * 0.7500000, size.height * 0.4107054); path_1.lineTo(size.width * 0.7500000, size.height * 0.6071292); path_1.close(); path_1.moveTo(size.width * 0.8214250, size.height * 0.4999875); path_1.cubicTo( size.width * 0.8312875, size.height * 0.4999875, size.width * 0.8392833, size.height * 0.5079833, size.width * 0.8392833, size.height * 0.5178458); path_1.cubicTo( size.width * 0.8392833, size.height * 0.5277083, size.width * 0.8312875, size.height * 0.5357042, size.width * 0.8214250, size.height * 0.5357042); path_1.cubicTo( size.width * 0.8115667, size.height * 0.5357042, size.width * 0.8035708, size.height * 0.5277083, size.width * 0.8035708, size.height * 0.5178458); path_1.cubicTo( size.width * 0.8035708, size.height * 0.5079833, size.width * 0.8115667, size.height * 0.4999875, size.width * 0.8214250, size.height * 0.4999875); path_1.close(); Paint paint_1_fill = Paint()..style = PaintingStyle.fill; paint_1_fill.color = Color(0xff4C5BD4).withOpacity(1.0); canvas.drawPath(path_1, paint_1_fill); Path path_2 = Path(); path_2.moveTo(size.width * 0.9642792, size.height * 0.6071417); path_2.lineTo(size.width * 0.9642792, size.height * 0.3214317); path_2.lineTo(size.width * 0.03572592, size.height * 0.3214317); path_2.lineTo(size.width * 0.03572592, size.height * 0.6071417); path_2.lineTo(size.width * 0.2857217, size.height * 0.6071417); path_2.lineTo(size.width * 0.2857217, size.height * 0.4107171); path_2.cubicTo( size.width * 0.2857217, size.height * 0.3909933, size.width * 0.3017117, size.height * 0.3750033, size.width * 0.3214354, size.height * 0.3750033); path_2.lineTo(size.width * 0.4285750, size.height * 0.3750033); path_2.cubicTo( size.width * 0.4483000, size.height * 0.3750033, size.width * 0.4642875, size.height * 0.3909933, size.width * 0.4642875, size.height * 0.4107171); path_2.lineTo(size.width * 0.4642875, size.height * 0.6071417); path_2.lineTo(size.width * 0.7142833, size.height * 0.6071417); path_2.lineTo(size.width * 0.7142833, size.height * 0.4107171); path_2.cubicTo( size.width * 0.7142833, size.height * 0.3909933, size.width * 0.7302750, size.height * 0.3750033, size.width * 0.7500000, size.height * 0.3750033); path_2.lineTo(size.width * 0.8571375, size.height * 0.3750033); path_2.cubicTo( size.width * 0.8768625, size.height * 0.3750033, size.width * 0.8928542, size.height * 0.3909933, size.width * 0.8928542, size.height * 0.4107171); path_2.lineTo(size.width * 0.8928542, size.height * 0.6071417); path_2.lineTo(size.width * 0.9642792, size.height * 0.6071417); path_2.lineTo(size.width * 0.9642792, size.height * 0.6071417); path_2.close(); path_2.moveTo(size.width * 0.2500083, size.height * 0.4642875); path_2.cubicTo( size.width * 0.2500083, size.height * 0.4840125, size.width * 0.2340183, size.height * 0.5000000, size.width * 0.2142950, size.height * 0.5000000); path_2.lineTo(size.width * 0.1428663, size.height * 0.5000000); path_2.cubicTo( size.width * 0.1231429, size.height * 0.5000000, size.width * 0.1071529, size.height * 0.4840125, size.width * 0.1071529, size.height * 0.4642875); path_2.lineTo(size.width * 0.1071529, size.height * 0.4107171); path_2.cubicTo( size.width * 0.1071529, size.height * 0.3909933, size.width * 0.1231429, size.height * 0.3750033, size.width * 0.1428663, size.height * 0.3750033); path_2.lineTo(size.width * 0.2142933, size.height * 0.3750033); path_2.cubicTo( size.width * 0.2340167, size.height * 0.3750033, size.width * 0.2500067, size.height * 0.3909933, size.width * 0.2500067, size.height * 0.4107171); path_2.lineTo(size.width * 0.2500067, size.height * 0.4642875); path_2.lineTo(size.width * 0.2500083, size.height * 0.4642875); path_2.close(); path_2.moveTo(size.width * 0.6785708, size.height * 0.4642875); path_2.cubicTo( size.width * 0.6785708, size.height * 0.4840125, size.width * 0.6625833, size.height * 0.5000000, size.width * 0.6428583, size.height * 0.5000000); path_2.lineTo(size.width * 0.5714292, size.height * 0.5000000); path_2.cubicTo( size.width * 0.5517083, size.height * 0.5000000, size.width * 0.5357167, size.height * 0.4840125, size.width * 0.5357167, size.height * 0.4642875); path_2.lineTo(size.width * 0.5357167, size.height * 0.4107171); path_2.cubicTo( size.width * 0.5357167, size.height * 0.3909933, size.width * 0.5517083, size.height * 0.3750033, size.width * 0.5714292, size.height * 0.3750033); path_2.lineTo(size.width * 0.6428583, size.height * 0.3750033); path_2.cubicTo( size.width * 0.6625833, size.height * 0.3750033, size.width * 0.6785708, size.height * 0.3909933, size.width * 0.6785708, size.height * 0.4107171); path_2.lineTo(size.width * 0.6785708, size.height * 0.4642875); path_2.close(); Paint paint_2_fill = Paint()..style = PaintingStyle.fill; paint_2_fill.color = Color(0xff4C5BD4).withOpacity(1.0); canvas.drawPath(path_2, paint_2_fill); Path path_3 = Path(); path_3.moveTo(size.width * 0.3214112, size.height * 0.6071292); path_3.lineTo(size.width * 0.4285500, size.height * 0.6071292); path_3.lineTo(size.width * 0.4285500, size.height * 0.4107054); path_3.lineTo(size.width * 0.3214112, size.height * 0.4107054); path_3.lineTo(size.width * 0.3214112, size.height * 0.6071292); path_3.close(); path_3.moveTo(size.width * 0.3928379, size.height * 0.4999875); path_3.cubicTo( size.width * 0.4026996, size.height * 0.4999875, size.width * 0.4106946, size.height * 0.5079833, size.width * 0.4106946, size.height * 0.5178458); path_3.cubicTo( size.width * 0.4106946, size.height * 0.5277083, size.width * 0.4026996, size.height * 0.5357042, size.width * 0.3928379, size.height * 0.5357042); path_3.cubicTo( size.width * 0.3829763, size.height * 0.5357042, size.width * 0.3749812, size.height * 0.5277083, size.width * 0.3749812, size.height * 0.5178458); path_3.cubicTo( size.width * 0.3749812, size.height * 0.5079833, size.width * 0.3829763, size.height * 0.4999875, size.width * 0.3928379, size.height * 0.4999875); path_3.close(); Paint paint_3_fill = Paint()..style = PaintingStyle.fill; paint_3_fill.color = Color(0xff4C5BD4).withOpacity(1.0); canvas.drawPath(path_3, paint_3_fill); Path path_4 = Path(); path_4.moveTo(size.width * 0.5714125, size.height * 0.4107054); path_4.lineTo(size.width * 0.6428542, size.height * 0.4107054); path_4.lineTo(size.width * 0.6428542, size.height * 0.4642750); path_4.lineTo(size.width * 0.5714125, size.height * 0.4642750); path_4.lineTo(size.width * 0.5714125, size.height * 0.4107054); path_4.close(); Paint paint_4_fill = Paint()..style = PaintingStyle.fill; paint_4_fill.color = Color(0xff4C5BD4).withOpacity(1.0); canvas.drawPath(path_4, paint_4_fill); Path path_5 = Path(); path_5.moveTo(size.width * 0.6606958, size.height * 0.01785675); path_5.cubicTo(size.width * 0.6606958, size.height * 0.007995000, size.width * 0.6527000, 0, size.width * 0.6428417, 0); path_5.lineTo(size.width * 0.3571308, 0); path_5.cubicTo( size.width * 0.3472692, 0, size.width * 0.3392742, size.height * 0.007995000, size.width * 0.3392742, size.height * 0.01785675); path_5.lineTo(size.width * 0.3392742, size.height * 0.2142825); path_5.lineTo(size.width * 0.6606958, size.height * 0.2142825); path_5.lineTo(size.width * 0.6606958, size.height * 0.01785675); path_5.close(); path_5.moveTo(size.width * 0.5714125, size.height * 0.1607121); path_5.cubicTo( size.width * 0.5714125, size.height * 0.1705742, size.width * 0.5634167, size.height * 0.1785692, size.width * 0.5535583, size.height * 0.1785692); path_5.cubicTo( size.width * 0.5436958, size.height * 0.1785692, size.width * 0.5357000, size.height * 0.1705742, size.width * 0.5357000, size.height * 0.1607121); path_5.lineTo(size.width * 0.5357000, size.height * 0.1071421); path_5.lineTo(size.width * 0.5142708, size.height * 0.1357133); path_5.cubicTo( size.width * 0.5107583, size.height * 0.1399850, size.width * 0.5055167, size.height * 0.1424583, size.width * 0.4999875, size.height * 0.1424583); path_5.cubicTo( size.width * 0.4944542, size.height * 0.1424583, size.width * 0.4892125, size.height * 0.1399833, size.width * 0.4857000, size.height * 0.1357133); path_5.lineTo(size.width * 0.4642708, size.height * 0.1071421); path_5.lineTo(size.width * 0.4642708, size.height * 0.1607121); path_5.cubicTo( size.width * 0.4642708, size.height * 0.1705742, size.width * 0.4562792, size.height * 0.1785692, size.width * 0.4464167, size.height * 0.1785692); path_5.cubicTo( size.width * 0.4365542, size.height * 0.1785692, size.width * 0.4285583, size.height * 0.1705742, size.width * 0.4285583, size.height * 0.1607121); path_5.lineTo(size.width * 0.4285583, size.height * 0.05357167); path_5.cubicTo( size.width * 0.4285583, size.height * 0.04588542, size.width * 0.4334792, size.height * 0.03906142, size.width * 0.4407708, size.height * 0.03663204); path_5.cubicTo( size.width * 0.4480625, size.height * 0.03420271, size.width * 0.4560917, size.height * 0.03670917, size.width * 0.4607000, size.height * 0.04285875); path_5.lineTo(size.width * 0.4999875, size.height * 0.09523333); path_5.lineTo(size.width * 0.5392708, size.height * 0.04285875); path_5.cubicTo( size.width * 0.5438833, size.height * 0.03670917, size.width * 0.5519125, size.height * 0.03420108, size.width * 0.5592042, size.height * 0.03663204); path_5.cubicTo( size.width * 0.5664958, size.height * 0.03906304, size.width * 0.5714125, size.height * 0.04588667, size.width * 0.5714125, size.height * 0.05357167); path_5.lineTo(size.width * 0.5714125, size.height * 0.1607121); path_5.close(); Paint paint_5_fill = Paint()..style = PaintingStyle.fill; paint_5_fill.color = Color(0xff4C5BD4).withOpacity(1.0); canvas.drawPath(path_5, paint_5_fill); Path path_6 = Path(); path_6.moveTo(size.width * 0.9821250, size.height * 0.2857137); path_6.lineTo(size.width, size.height * 0.2857137); path_6.lineTo(size.width * 0.9999833, size.height * 0.2500000); path_6.lineTo(0, size.height * 0.2500000); path_6.lineTo(0, size.height * 0.2857137); path_6.lineTo(size.width * 0.01785675, size.height * 0.2857137); path_6.lineTo(size.width * 0.9821250, size.height * 0.2857137); path_6.close(); Paint paint_6_fill = Paint()..style = PaintingStyle.fill; paint_6_fill.color = Color(0xff4C5BD4).withOpacity(1.0); canvas.drawPath(path_6, paint_6_fill); Path path_7 = Path(); path_7.moveTo(size.width * 0.1428629, size.height * 0.4107054); path_7.lineTo(size.width * 0.2143079, size.height * 0.4107054); path_7.lineTo(size.width * 0.2143079, size.height * 0.4642750); path_7.lineTo(size.width * 0.1428629, size.height * 0.4642750); path_7.lineTo(size.width * 0.1428629, size.height * 0.4107054); path_7.close(); Paint paint_7_fill = Paint()..style = PaintingStyle.fill; paint_7_fill.color = Color(0xff4C5BD4).withOpacity(1.0); canvas.drawPath(path_7, paint_7_fill); Path path_8 = Path(); path_8.moveTo(size.width * 0.9821250, size.height * 0.6428417); path_8.lineTo(size.width * 0.01785675, size.height * 0.6428417); path_8.lineTo(0, size.height * 0.6428417); path_8.lineTo(0, size.height * 0.6785542); path_8.lineTo(size.width * 0.01785675, size.height * 0.6785542); path_8.lineTo(size.width * 0.9821250, size.height * 0.6785542); path_8.lineTo(size.width, size.height * 0.6785542); path_8.lineTo(size.width * 0.9999833, size.height * 0.6428417); path_8.lineTo(size.width * 0.9821250, size.height * 0.6428417); path_8.close(); Paint paint_8_fill = Paint()..style = PaintingStyle.fill; paint_8_fill.color = Color(0xff4C5BD4).withOpacity(1.0); canvas.drawPath(path_8, paint_8_fill); Path path_9 = Path(); path_9.moveTo(size.width * 0.03572592, size.height * 0.9821250); path_9.cubicTo( size.width * 0.03572592, size.height * 0.9919875, size.width * 0.04372083, size.height * 0.9999833, size.width * 0.05358250, size.height * 0.9999833); path_9.lineTo(size.width * 0.2857217, size.height * 0.9999833); path_9.lineTo(size.width * 0.2857217, size.height * 0.8035583); path_9.cubicTo( size.width * 0.2857217, size.height * 0.7838375, size.width * 0.3017117, size.height * 0.7678458, size.width * 0.3214354, size.height * 0.7678458); path_9.lineTo(size.width * 0.4285750, size.height * 0.7678458); path_9.cubicTo( size.width * 0.4483000, size.height * 0.7678458, size.width * 0.4642875, size.height * 0.7838375, size.width * 0.4642875, size.height * 0.8035583); path_9.lineTo(size.width * 0.4642875, size.height * 0.9999833); path_9.lineTo(size.width * 0.7142833, size.height * 0.9999833); path_9.lineTo(size.width * 0.7142833, size.height * 0.8035583); path_9.cubicTo( size.width * 0.7142833, size.height * 0.7838375, size.width * 0.7302750, size.height * 0.7678458, size.width * 0.7500000, size.height * 0.7678458); path_9.lineTo(size.width * 0.8571375, size.height * 0.7678458); path_9.cubicTo( size.width * 0.8768625, size.height * 0.7678458, size.width * 0.8928542, size.height * 0.7838375, size.width * 0.8928542, size.height * 0.8035583); path_9.lineTo(size.width * 0.8928542, size.height * 0.9999833); path_9.lineTo(size.width * 0.9464208, size.height * 0.9999833); path_9.cubicTo( size.width * 0.9562833, size.height * 0.9999833, size.width * 0.9642792, size.height * 0.9919875, size.width * 0.9642792, size.height * 0.9821292); path_9.lineTo(size.width * 0.9642792, size.height * 0.7142750); path_9.lineTo(size.width * 0.03572592, size.height * 0.7142750); path_9.lineTo(size.width * 0.03572592, size.height * 0.9821250); path_9.close(); path_9.moveTo(size.width * 0.5357167, size.height * 0.8035583); path_9.cubicTo( size.width * 0.5357167, size.height * 0.7838375, size.width * 0.5517042, size.height * 0.7678458, size.width * 0.5714292, size.height * 0.7678458); path_9.lineTo(size.width * 0.6428583, size.height * 0.7678458); path_9.cubicTo( size.width * 0.6625792, size.height * 0.7678458, size.width * 0.6785708, size.height * 0.7838375, size.width * 0.6785708, size.height * 0.8035583); path_9.lineTo(size.width * 0.6785708, size.height * 0.8571292); path_9.cubicTo( size.width * 0.6785708, size.height * 0.8768542, size.width * 0.6625792, size.height * 0.8928417, size.width * 0.6428583, size.height * 0.8928417); path_9.lineTo(size.width * 0.5714292, size.height * 0.8928417); path_9.cubicTo( size.width * 0.5517042, size.height * 0.8928417, size.width * 0.5357167, size.height * 0.8768542, size.width * 0.5357167, size.height * 0.8571292); path_9.lineTo(size.width * 0.5357167, size.height * 0.8035583); path_9.close(); path_9.moveTo(size.width * 0.1071529, size.height * 0.8035583); path_9.cubicTo( size.width * 0.1071529, size.height * 0.7838375, size.width * 0.1231429, size.height * 0.7678458, size.width * 0.1428663, size.height * 0.7678458); path_9.lineTo(size.width * 0.2142933, size.height * 0.7678458); path_9.cubicTo( size.width * 0.2340167, size.height * 0.7678458, size.width * 0.2500067, size.height * 0.7838375, size.width * 0.2500067, size.height * 0.8035583); path_9.lineTo(size.width * 0.2500067, size.height * 0.8571292); path_9.cubicTo( size.width * 0.2500067, size.height * 0.8768542, size.width * 0.2340167, size.height * 0.8928417, size.width * 0.2142933, size.height * 0.8928417); path_9.lineTo(size.width * 0.1428663, size.height * 0.8928417); path_9.cubicTo( size.width * 0.1231429, size.height * 0.8928417, size.width * 0.1071529, size.height * 0.8768542, size.width * 0.1071529, size.height * 0.8571292); path_9.lineTo(size.width * 0.1071529, size.height * 0.8035583); path_9.close(); Paint paint_9_fill = Paint()..style = PaintingStyle.fill; paint_9_fill.color = Color(0xff4C5BD4).withOpacity(1.0); canvas.drawPath(path_9, paint_9_fill); Path path_10 = Path(); path_10.moveTo(size.width * 0.1428629, size.height * 0.8035667); path_10.lineTo(size.width * 0.2143079, size.height * 0.8035667); path_10.lineTo(size.width * 0.2143079, size.height * 0.8571375); path_10.lineTo(size.width * 0.1428629, size.height * 0.8571375); path_10.lineTo(size.width * 0.1428629, size.height * 0.8035667); path_10.close(); Paint paint_10_fill = Paint()..style = PaintingStyle.fill; paint_10_fill.color = Color(0xff4C5BD4).withOpacity(1.0); canvas.drawPath(path_10, paint_10_fill); Path path_11 = Path(); path_11.moveTo(size.width * 0.7500000, size.height * 0.9999917); path_11.lineTo(size.width * 0.8571417, size.height * 0.9999917); path_11.lineTo(size.width * 0.8571417, size.height * 0.8035667); path_11.lineTo(size.width * 0.7500000, size.height * 0.8035667); path_11.lineTo(size.width * 0.7500000, size.height * 0.9999917); path_11.close(); path_11.moveTo(size.width * 0.8214250, size.height * 0.8928542); path_11.cubicTo( size.width * 0.8312875, size.height * 0.8928542, size.width * 0.8392833, size.height * 0.9008458, size.width * 0.8392833, size.height * 0.9107083); path_11.cubicTo( size.width * 0.8392833, size.height * 0.9205708, size.width * 0.8312875, size.height * 0.9285667, size.width * 0.8214250, size.height * 0.9285667); path_11.cubicTo( size.width * 0.8115667, size.height * 0.9285667, size.width * 0.8035708, size.height * 0.9205708, size.width * 0.8035708, size.height * 0.9107083); path_11.cubicTo( size.width * 0.8035708, size.height * 0.9008458, size.width * 0.8115667, size.height * 0.8928542, size.width * 0.8214250, size.height * 0.8928542); path_11.close(); Paint paint_11_fill = Paint()..style = PaintingStyle.fill; paint_11_fill.color = Color(0xff4C5BD4).withOpacity(1.0); canvas.drawPath(path_11, paint_11_fill); Path path_12 = Path(); path_12.moveTo(size.width * 0.5714125, size.height * 0.8035667); path_12.lineTo(size.width * 0.6428542, size.height * 0.8035667); path_12.lineTo(size.width * 0.6428542, size.height * 0.8571375); path_12.lineTo(size.width * 0.5714125, size.height * 0.8571375); path_12.lineTo(size.width * 0.5714125, size.height * 0.8035667); path_12.close(); Paint paint_12_fill = Paint()..style = PaintingStyle.fill; paint_12_fill.color = Color(0xff4C5BD4).withOpacity(1.0); canvas.drawPath(path_12, paint_12_fill); Path path_13 = Path(); path_13.moveTo(size.width * 0.01786296, size.height * 0.1785704); path_13.lineTo(size.width * 0.01786296, size.height * 0.2142837); path_13.lineTo(size.width * 0.05357625, size.height * 0.2142837); path_13.lineTo(size.width * 0.05357625, size.height * 0.1785704); path_13.cubicTo( size.width * 0.05357625, size.height * 0.1687087, size.width * 0.06157125, size.height * 0.1607133, size.width * 0.07143333, size.height * 0.1607133); path_13.lineTo(size.width * 0.08929000, size.height * 0.1607133); path_13.lineTo(size.width * 0.08929000, size.height * 0.2142837); path_13.lineTo(size.width * 0.1250033, size.height * 0.2142837); path_13.lineTo(size.width * 0.1250033, size.height * 0.1607133); path_13.lineTo(size.width * 0.1607167, size.height * 0.1607133); path_13.lineTo(size.width * 0.1607167, size.height * 0.2142837); path_13.lineTo(size.width * 0.1964304, size.height * 0.2142837); path_13.lineTo(size.width * 0.1964304, size.height * 0.1607133); path_13.lineTo(size.width * 0.2321437, size.height * 0.1607133); path_13.lineTo(size.width * 0.2321437, size.height * 0.2142837); path_13.lineTo(size.width * 0.2678571, size.height * 0.2142837); path_13.lineTo(size.width * 0.2678571, size.height * 0.1607133); path_13.lineTo(size.width * 0.3035708, size.height * 0.1607133); path_13.lineTo(size.width * 0.3035708, size.height * 0.1250000); path_13.lineTo(size.width * 0.07143333, size.height * 0.1250000); path_13.cubicTo( size.width * 0.04184792, size.height * 0.1250000, size.width * 0.01786296, size.height * 0.1489833, size.width * 0.01786296, size.height * 0.1785704); path_13.close(); Paint paint_13_fill = Paint()..style = PaintingStyle.fill; paint_13_fill.color = Color(0xff4C5BD4).withOpacity(1.0); canvas.drawPath(path_13, paint_13_fill); Path path_14 = Path(); path_14.moveTo(size.width * 0.9285500, size.height * 0.1250000); path_14.lineTo(size.width * 0.6964125, size.height * 0.1250000); path_14.lineTo(size.width * 0.6964125, size.height * 0.1607133); path_14.lineTo(size.width * 0.7321250, size.height * 0.1607133); path_14.lineTo(size.width * 0.7321250, size.height * 0.2142837); path_14.lineTo(size.width * 0.7678375, size.height * 0.2142837); path_14.lineTo(size.width * 0.7678375, size.height * 0.1607133); path_14.lineTo(size.width * 0.8035500, size.height * 0.1607133); path_14.lineTo(size.width * 0.8035500, size.height * 0.2142837); path_14.lineTo(size.width * 0.8392667, size.height * 0.2142837); path_14.lineTo(size.width * 0.8392667, size.height * 0.1607133); path_14.lineTo(size.width * 0.8749792, size.height * 0.1607133); path_14.lineTo(size.width * 0.8749792, size.height * 0.2142837); path_14.lineTo(size.width * 0.9106917, size.height * 0.2142837); path_14.lineTo(size.width * 0.9106917, size.height * 0.1607133); path_14.lineTo(size.width * 0.9285500, size.height * 0.1607133); path_14.cubicTo( size.width * 0.9384083, size.height * 0.1607133, size.width * 0.9464042, size.height * 0.1687087, size.width * 0.9464042, size.height * 0.1785704); path_14.lineTo(size.width * 0.9464042, size.height * 0.2142837); path_14.lineTo(size.width * 0.9821208, size.height * 0.2142837); path_14.lineTo(size.width * 0.9821208, size.height * 0.1785704); path_14.cubicTo( size.width * 0.9821208, size.height * 0.1489833, size.width * 0.9581375, size.height * 0.1250000, size.width * 0.9285500, size.height * 0.1250000); path_14.close(); Paint paint_14_fill = Paint()..style = PaintingStyle.fill; paint_14_fill.color = Color(0xff4C5BD4).withOpacity(1.0); canvas.drawPath(path_14, paint_14_fill); } @override bool shouldRepaint(covariant CustomPainter oldDelegate) => false; }
0
mirrored_repositories/flutter_mockup_bloc/lib/utils/ui
mirrored_repositories/flutter_mockup_bloc/lib/utils/ui/drawer/insurance_icon_painter.dart
// ignore_for_file: non_constant_identifier_names import 'package:flutter/material.dart'; class InsuranceIconPainter extends CustomPainter { const InsuranceIconPainter(); @override void paint(Canvas canvas, Size size) { Path path_0 = Path(); path_0.moveTo(size.width * 0.6855458, size.height * 0.01717121); path_0.lineTo(size.width * 0.6855458, size.height * 0.1953217); path_0.lineTo(size.width * 0.8636958, size.height * 0.1953217); path_0.lineTo(size.width * 0.6855458, size.height * 0.01717121); path_0.close(); Paint paint_0_fill = Paint()..style = PaintingStyle.fill; paint_0_fill.color = Color(0xff4C5BD4).withOpacity(1.0); canvas.drawPath(path_0, paint_0_fill); Path path_1 = Path(); path_1.moveTo(size.width * 0.5603042, size.height * 0.3750000); path_1.lineTo(size.width * 0.4396958, size.height * 0.3750000); path_1.cubicTo( size.width * 0.4168708, size.height * 0.4148496, size.width * 0.3783221, size.height * 0.4420292, size.width * 0.3339842, size.height * 0.4503958); path_1.lineTo(size.width * 0.3339842, size.height * 0.5910125); path_1.cubicTo( size.width * 0.3339842, size.height * 0.6969792, size.width * 0.4003342, size.height * 0.7890292, size.width * 0.5000000, size.height * 0.8227708); path_1.cubicTo( size.width * 0.5996667, size.height * 0.7890292, size.width * 0.6660167, size.height * 0.6969792, size.width * 0.6660167, size.height * 0.5910125); path_1.lineTo(size.width * 0.6660167, size.height * 0.4503958); path_1.cubicTo( size.width * 0.6216792, size.height * 0.4420292, size.width * 0.5831292, size.height * 0.4148475, size.width * 0.5603042, size.height * 0.3750000); path_1.close(); path_1.moveTo(size.width * 0.6035792, size.height * 0.5650833); path_1.lineTo(size.width * 0.4930958, size.height * 0.6755667); path_1.cubicTo( size.width * 0.4873750, size.height * 0.6812875, size.width * 0.4798750, size.height * 0.6841500, size.width * 0.4723792, size.height * 0.6841500); path_1.cubicTo( size.width * 0.4648833, size.height * 0.6841500, size.width * 0.4573833, size.height * 0.6812875, size.width * 0.4516667, size.height * 0.6755667); path_1.lineTo(size.width * 0.3964238, size.height * 0.6203250); path_1.cubicTo( size.width * 0.3849825, size.height * 0.6088833, size.width * 0.3849825, size.height * 0.5903333, size.width * 0.3964238, size.height * 0.5788917); path_1.cubicTo( size.width * 0.4078633, size.height * 0.5674500, size.width * 0.4264125, size.height * 0.5674500, size.width * 0.4378542, size.height * 0.5788917); path_1.lineTo(size.width * 0.4723833, size.height * 0.6134167); path_1.lineTo(size.width * 0.5621542, size.height * 0.5236500); path_1.cubicTo( size.width * 0.5735917, size.height * 0.5122083, size.width * 0.5921417, size.height * 0.5122083, size.width * 0.6035833, size.height * 0.5236500); path_1.cubicTo( size.width * 0.6150208, size.height * 0.5350917, size.width * 0.6150208, size.height * 0.5536417, size.width * 0.6035792, size.height * 0.5650833); path_1.close(); Paint paint_1_fill = Paint()..style = PaintingStyle.fill; paint_1_fill.color = Color(0xff4C5BD4).withOpacity(1.0); canvas.drawPath(path_1, paint_1_fill); Path path_2 = Path(); path_2.moveTo(size.width * 0.6562500, size.height * 0.2539063); path_2.cubicTo( size.width * 0.6400708, size.height * 0.2539063, size.width * 0.6269542, size.height * 0.2407892, size.width * 0.6269542, size.height * 0.2246092); path_2.lineTo(size.width * 0.6269542, 0); path_2.lineTo(size.width * 0.2265625, 0); path_2.cubicTo( size.width * 0.1673300, 0, size.width * 0.1191408, size.height * 0.04818958, size.width * 0.1191408, size.height * 0.1074217); path_2.lineTo(size.width * 0.1191408, size.height * 0.8925792); path_2.cubicTo( size.width * 0.1191408, size.height * 0.9518125, size.width * 0.1673300, size.height, size.width * 0.2265625, size.height); path_2.lineTo(size.width * 0.7734375, size.height); path_2.cubicTo( size.width * 0.8326708, size.height, size.width * 0.8808583, size.height * 0.9518125, size.width * 0.8808583, size.height * 0.8925792); path_2.lineTo(size.width * 0.8808583, size.height * 0.2539063); path_2.lineTo(size.width * 0.6562500, size.height * 0.2539063); path_2.close(); path_2.moveTo(size.width * 0.7246083, size.height * 0.5910083); path_2.cubicTo( size.width * 0.7246083, size.height * 0.6567417, size.width * 0.7038708, size.height * 0.7193583, size.width * 0.6646333, size.height * 0.7720958); path_2.cubicTo( size.width * 0.6253958, size.height * 0.8248292, size.width * 0.5713750, size.height * 0.8626875, size.width * 0.5084167, size.height * 0.8815750); path_2.cubicTo( size.width * 0.5056708, size.height * 0.8824000, size.width * 0.5028375, size.height * 0.8828125, size.width * 0.5000000, size.height * 0.8828125); path_2.cubicTo( size.width * 0.4971625, size.height * 0.8828125, size.width * 0.4943292, size.height * 0.8824000, size.width * 0.4915833, size.height * 0.8815750); path_2.cubicTo( size.width * 0.4286250, size.height * 0.8626875, size.width * 0.3746033, size.height * 0.8248292, size.width * 0.3353671, size.height * 0.7720958); path_2.cubicTo( size.width * 0.2961308, size.height * 0.7193583, size.width * 0.2753908, size.height * 0.6567417, size.width * 0.2753908, size.height * 0.5910083); path_2.lineTo(size.width * 0.2753908, size.height * 0.4238292); path_2.cubicTo( size.width * 0.2753908, size.height * 0.4076483, size.width * 0.2885079, size.height * 0.3945313, size.width * 0.3046875, size.height * 0.3945313); path_2.cubicTo( size.width * 0.3417092, size.height * 0.3945313, size.width * 0.3749921, size.height * 0.3739608, size.width * 0.3915471, size.height * 0.3408496); path_2.lineTo(size.width * 0.3956700, size.height * 0.3326033); path_2.cubicTo( size.width * 0.4006329, size.height * 0.3226758, size.width * 0.4107775, size.height * 0.3164063, size.width * 0.4218750, size.height * 0.3164063); path_2.lineTo(size.width * 0.5781250, size.height * 0.3164063); path_2.cubicTo( size.width * 0.5892208, size.height * 0.3164063, size.width * 0.5993667, size.height * 0.3226758, size.width * 0.6043292, size.height * 0.3326017); path_2.lineTo(size.width * 0.6084542, size.height * 0.3408496); path_2.cubicTo( size.width * 0.6250083, size.height * 0.3739608, size.width * 0.6582917, size.height * 0.3945313, size.width * 0.6953125, size.height * 0.3945313); path_2.cubicTo( size.width * 0.7114917, size.height * 0.3945313, size.width * 0.7246083, size.height * 0.4076483, size.width * 0.7246083, size.height * 0.4238292); path_2.lineTo(size.width * 0.7246083, size.height * 0.5910083); path_2.close(); Paint paint_2_fill = Paint()..style = PaintingStyle.fill; paint_2_fill.color = Color(0xff4C5BD4).withOpacity(1.0); canvas.drawPath(path_2, paint_2_fill); } @override bool shouldRepaint(covariant CustomPainter oldDelegate) => false; }
0
mirrored_repositories/flutter_mockup_bloc/lib/utils/ui
mirrored_repositories/flutter_mockup_bloc/lib/utils/ui/dialog/info_icon_painter.dart
// ignore_for_file: non_constant_identifier_names import 'package:flutter/material.dart'; class InfoIconPainter extends CustomPainter { const InfoIconPainter(); @override void paint(Canvas canvas, Size size) { Path path_0 = Path(); path_0.moveTo(size.width * 0.5000000, size.height); path_0.cubicTo(size.width * 0.7761429, size.height, size.width, size.height * 0.7761429, size.width, size.height * 0.5000000); path_0.cubicTo(size.width, size.height * 0.2238571, size.width * 0.7761429, 0, size.width * 0.5000000, 0); path_0.cubicTo(size.width * 0.2238571, 0, 0, size.height * 0.2238571, 0, size.height * 0.5000000); path_0.cubicTo(0, size.height * 0.7761429, size.width * 0.2238571, size.height, size.width * 0.5000000, size.height); path_0.close(); Paint paint_0_fill = Paint()..style = PaintingStyle.fill; paint_0_fill.color = Color(0xff70C652).withOpacity(1.0); canvas.drawPath(path_0, paint_0_fill); Path path_1 = Path(); path_1.moveTo(size.width * 0.5946929, size.height * 0.9905471); path_1.cubicTo( size.width * 0.6078257, size.height * 0.9881529, size.width * 0.6208571, size.height * 0.9852343, size.width * 0.6337557, size.height * 0.9817971); path_1.cubicTo( size.width * 0.6498157, size.height * 0.9773300, size.width * 0.6656429, size.height * 0.9720629, size.width * 0.6811771, size.height * 0.9660157); path_1.cubicTo( size.width * 0.6967157, size.height * 0.9599829, size.width * 0.7119429, size.height * 0.9531786, size.width * 0.7268029, size.height * 0.9456243); path_1.cubicTo( size.width * 0.7416629, size.height * 0.9380457, size.width * 0.7561329, size.height * 0.9297286, size.width * 0.7701614, size.height * 0.9207029); path_1.cubicTo( size.width * 0.7841786, size.height * 0.9116986, size.width * 0.7977371, size.height * 0.9019986, size.width * 0.8107871, size.height * 0.8916400); path_1.cubicTo( size.width * 0.8238543, size.height * 0.8812843, size.width * 0.8363971, size.height * 0.8702814, size.width * 0.8483643, size.height * 0.8586714); path_1.cubicTo( size.width * 0.8603214, size.height * 0.8470600, size.width * 0.8716900, size.height * 0.8348571, size.width * 0.8824271, size.height * 0.8221086); path_1.cubicTo( size.width * 0.8931614, size.height * 0.8093657, size.width * 0.9032529, size.height * 0.7960943, size.width * 0.9126614, size.height * 0.7823443); path_1.cubicTo( size.width * 0.9220929, size.height * 0.7685700, size.width * 0.9308271, size.height * 0.7543343, size.width * 0.9388343, size.height * 0.7396871); path_1.cubicTo( size.width * 0.9468186, size.height * 0.7250586, size.width * 0.9540671, size.height * 0.7100400, size.width * 0.9605529, size.height * 0.6946871); path_1.cubicTo( size.width * 0.9670343, size.height * 0.6793314, size.width * 0.9727443, size.height * 0.6636614, size.width * 0.9776614, size.height * 0.6477343); path_1.cubicTo( size.width * 0.9825814, size.height * 0.6318043, size.width * 0.9867014, size.height * 0.6156386, size.width * 0.9900057, size.height * 0.5992971); path_1.cubicTo( size.width * 0.9902471, size.height * 0.5978129, size.width * 0.9904814, size.height * 0.5963286, size.width * 0.9907086, size.height * 0.5948443); path_1.lineTo(size.width * 0.6978957, size.height * 0.3021100); path_1.cubicTo( size.width * 0.6471971, size.height * 0.2514086, size.width * 0.5772071, size.height * 0.2200000, size.width * 0.5000057, size.height * 0.2200000); path_1.cubicTo( size.width * 0.3456029, size.height * 0.2200000, size.width * 0.2200057, size.height * 0.3456000, size.width * 0.2200057, size.height * 0.5000000); path_1.cubicTo( size.width * 0.2200057, size.height * 0.5675500, size.width * 0.2440157, size.height * 0.6295500, size.width * 0.2839900, size.height * 0.6779686); path_1.lineTo(size.width * 0.2839900, size.height * 0.6780471); path_1.cubicTo( size.width * 0.2896900, size.height * 0.6849471, size.width * 0.2957914, size.height * 0.6915671, size.width * 0.3021143, size.height * 0.6978900); path_1.lineTo(size.width * 0.5946929, size.height * 0.9905471); path_1.close(); Paint paint_1_fill = Paint()..style = PaintingStyle.fill; paint_1_fill.color = Color(0xff4F8C3A).withOpacity(1.0); canvas.drawPath(path_1, paint_1_fill); Path path_2 = Path(); path_2.moveTo(size.width * 0.5000057, size.height * 0.2200000); path_2.cubicTo( size.width * 0.3456029, size.height * 0.2200000, size.width * 0.2200057, size.height * 0.3456000, size.width * 0.2200057, size.height * 0.5000000); path_2.cubicTo( size.width * 0.2200057, size.height * 0.6544043, size.width * 0.3456029, size.height * 0.7800000, size.width * 0.5000057, size.height * 0.7800000); path_2.cubicTo( size.width * 0.6544086, size.height * 0.7800000, size.width * 0.7800057, size.height * 0.6544043, size.width * 0.7800057, size.height * 0.5000000); path_2.cubicTo( size.width * 0.7800057, size.height * 0.3456000, size.width * 0.6544086, size.height * 0.2200000, size.width * 0.5000057, size.height * 0.2200000); path_2.close(); path_2.moveTo(size.width * 0.5000057, size.height * 0.2600000); path_2.cubicTo( size.width * 0.6327914, size.height * 0.2600000, size.width * 0.7400057, size.height * 0.3672157, size.width * 0.7400057, size.height * 0.5000000); path_2.cubicTo( size.width * 0.7400057, size.height * 0.6327886, size.width * 0.6327914, size.height * 0.7400000, size.width * 0.5000057, size.height * 0.7400000); path_2.cubicTo( size.width * 0.3672200, size.height * 0.7400000, size.width * 0.2600057, size.height * 0.6327886, size.width * 0.2600057, size.height * 0.5000000); path_2.cubicTo( size.width * 0.2600057, size.height * 0.3672157, size.width * 0.3672200, size.height * 0.2600000, size.width * 0.5000057, size.height * 0.2600000); path_2.close(); path_2.moveTo(size.width * 0.4800057, size.height * 0.3400000); path_2.lineTo(size.width * 0.4800057, size.height * 0.3800000); path_2.lineTo(size.width * 0.5200057, size.height * 0.3800000); path_2.lineTo(size.width * 0.5200057, size.height * 0.3400000); path_2.lineTo(size.width * 0.4800057, size.height * 0.3400000); path_2.close(); path_2.moveTo(size.width * 0.4800057, size.height * 0.4200000); path_2.lineTo(size.width * 0.4800057, size.height * 0.6600000); path_2.lineTo(size.width * 0.5200057, size.height * 0.6600000); path_2.lineTo(size.width * 0.5200057, size.height * 0.4200000); path_2.lineTo(size.width * 0.4800057, size.height * 0.4200000); path_2.close(); Paint paint_2_fill = Paint()..style = PaintingStyle.fill; paint_2_fill.color = Colors.white.withOpacity(1.0); canvas.drawPath(path_2, paint_2_fill); } @override bool shouldRepaint(covariant CustomPainter oldDelegate) => false; }
0
mirrored_repositories/flutter_mockup_bloc/lib/utils/ui
mirrored_repositories/flutter_mockup_bloc/lib/utils/ui/dialog/power_icon_painter.dart
// ignore_for_file: non_constant_identifier_names import 'package:flutter/material.dart'; class PowerIconPainter extends CustomPainter { const PowerIconPainter(); @override void paint(Canvas canvas, Size size) { Path path_0 = Path(); path_0.moveTo(size.width * 0.5000000, size.height * 1.000001); path_0.cubicTo(size.width * 0.7761429, size.height * 1.000001, size.width, size.height * 0.7761443, size.width, size.height * 0.5000014); path_0.cubicTo(size.width, size.height * 0.2238600, size.width * 0.7761429, 0, size.width * 0.5000000, 0); path_0.cubicTo(size.width * 0.2238571, 0, 0, size.height * 0.2238600, 0, size.height * 0.5000014); path_0.cubicTo(0, size.height * 0.7761443, size.width * 0.2238571, size.height * 1.000001, size.width * 0.5000000, size.height * 1.000001); path_0.close(); Paint paint_0_fill = Paint()..style = PaintingStyle.fill; paint_0_fill.color = Color(0xffFA0000).withOpacity(1.0); canvas.drawPath(path_0, paint_0_fill); Path path_1 = Path(); path_1.moveTo(size.width * 0.6511771, size.height * 0.9759557); path_1.cubicTo( size.width * 0.6612686, size.height * 0.9729557, size.width * 0.6712629, size.height * 0.9696386, size.width * 0.6811443, size.height * 0.9660071); path_1.cubicTo( size.width * 0.6966929, size.height * 0.9599771, size.width * 0.7119300, size.height * 0.9531743, size.width * 0.7267986, size.height * 0.9456214); path_1.cubicTo( size.width * 0.7416500, size.height * 0.9380486, size.width * 0.7561129, size.height * 0.9297371, size.width * 0.7701343, size.height * 0.9207186); path_1.cubicTo( size.width * 0.7841600, size.height * 0.9117186, size.width * 0.7977257, size.height * 0.9020214, size.width * 0.8107829, size.height * 0.8916657); path_1.cubicTo( size.width * 0.8238371, size.height * 0.8813129, size.width * 0.8363643, size.height * 0.8703129, size.width * 0.8483200, size.height * 0.8587071); path_1.cubicTo( size.width * 0.8602971, size.height * 0.8470771, size.width * 0.8716843, size.height * 0.8348557, size.width * 0.8824386, size.height * 0.8220857); path_1.cubicTo( size.width * 0.8931643, size.height * 0.8093529, size.width * 0.9032486, size.height * 0.7960914, size.width * 0.9126514, size.height * 0.7823529); path_1.cubicTo( size.width * 0.9220657, size.height * 0.7685757, size.width * 0.9307843, size.height * 0.7543371, size.width * 0.9387743, size.height * 0.7396886); path_1.cubicTo( size.width * 0.9467614, size.height * 0.7250657, size.width * 0.9540143, size.height * 0.7100529, size.width * 0.9605029, size.height * 0.6947057); path_1.cubicTo( size.width * 0.9631100, size.height * 0.6880057, size.width * 0.9655729, size.height * 0.6812486, size.width * 0.9678886, size.height * 0.6744429); path_1.lineTo(size.width * 0.6544114, size.height * 0.3609657); path_1.cubicTo( size.width * 0.6539743, size.height * 0.3605271, size.width * 0.6534486, size.height * 0.3601786, size.width * 0.6530071, size.height * 0.3597443); path_1.cubicTo( size.width * 0.6419343, size.height * 0.3488586, size.width * 0.6296271, size.height * 0.3391000, size.width * 0.6162643, size.height * 0.3306914); path_1.cubicTo( size.width * 0.6144971, size.height * 0.3295814, size.width * 0.6126986, size.height * 0.3285200, size.width * 0.6108929, size.height * 0.3274571); path_1.cubicTo( size.width * 0.6056329, size.height * 0.3243557, size.width * 0.6002243, size.height * 0.3214657, size.width * 0.5946586, size.height * 0.3187900); path_1.cubicTo( size.width * 0.5928286, size.height * 0.3179114, size.width * 0.5910257, size.height * 0.3169971, size.width * 0.5891643, size.height * 0.3161657); path_1.cubicTo( size.width * 0.5818243, size.height * 0.3128857, size.width * 0.5743314, size.height * 0.3098729, size.width * 0.5665214, size.height * 0.3073771); path_1.cubicTo( size.width * 0.5631657, size.height * 0.3062500, size.width * 0.5595286, size.height * 0.3062943, size.width * 0.5562029, size.height * 0.3075029); path_1.cubicTo( size.width * 0.5528771, size.height * 0.3087114, size.width * 0.5500586, size.height * 0.3110129, size.width * 0.5482100, size.height * 0.3140300); path_1.lineTo(size.width * 0.5157400, size.height * 0.2815586); path_1.cubicTo( size.width * 0.5157729, size.height * 0.2794657, size.width * 0.5153843, size.height * 0.2773871, size.width * 0.5145986, size.height * 0.2754471); path_1.cubicTo( size.width * 0.5138129, size.height * 0.2735071, size.width * 0.5126443, size.height * 0.2717443, size.width * 0.5111643, size.height * 0.2702643); path_1.cubicTo( size.width * 0.5096843, size.height * 0.2687843, size.width * 0.5079214, size.height * 0.2676171, size.width * 0.5059814, size.height * 0.2668314); path_1.cubicTo( size.width * 0.5040414, size.height * 0.2660457, size.width * 0.5019629, size.height * 0.2656571, size.width * 0.4998700, size.height * 0.2656900); path_1.cubicTo( size.width * 0.4978186, size.height * 0.2657214, size.width * 0.4957929, size.height * 0.2661571, size.width * 0.4939100, size.height * 0.2669729); path_1.cubicTo( size.width * 0.4920257, size.height * 0.2677871, size.width * 0.4903214, size.height * 0.2689657, size.width * 0.4888929, size.height * 0.2704386); path_1.cubicTo( size.width * 0.4874643, size.height * 0.2719129, size.width * 0.4863414, size.height * 0.2736529, size.width * 0.4855857, size.height * 0.2755614); path_1.cubicTo( size.width * 0.4848300, size.height * 0.2774686, size.width * 0.4844571, size.height * 0.2795071, size.width * 0.4844900, size.height * 0.2815586); path_1.lineTo(size.width * 0.4844900, size.height * 0.3579143); path_1.lineTo(size.width * 0.4536671, size.height * 0.3270914); path_1.cubicTo( size.width * 0.4544886, size.height * 0.3246729, size.width * 0.4547043, size.height * 0.3220914, size.width * 0.4542957, size.height * 0.3195700); path_1.cubicTo( size.width * 0.4538886, size.height * 0.3170486, size.width * 0.4528686, size.height * 0.3146671, size.width * 0.4513271, size.height * 0.3126314); path_1.cubicTo( size.width * 0.4497857, size.height * 0.3105957, size.width * 0.4477686, size.height * 0.3089686, size.width * 0.4454529, size.height * 0.3078929); path_1.cubicTo( size.width * 0.4431357, size.height * 0.3068171, size.width * 0.4405914, size.height * 0.3063257, size.width * 0.4380414, size.height * 0.3064614); path_1.lineTo(size.width * 0.4380414, size.height * 0.3065229); path_1.cubicTo( size.width * 0.4366314, size.height * 0.3065771, size.width * 0.4352357, size.height * 0.3068243, size.width * 0.4338914, size.height * 0.3072543); path_1.cubicTo( size.width * 0.4018029, size.height * 0.3174286, size.width * 0.3735571, size.height * 0.3345229, size.width * 0.3503343, size.height * 0.3563886); path_1.cubicTo( size.width * 0.3457029, size.height * 0.3607486, size.width * 0.3412471, size.height * 0.3652700, size.width * 0.3370286, size.height * 0.3699986); path_1.lineTo(size.width * 0.3370286, size.height * 0.3700600); path_1.cubicTo( size.width * 0.3328114, size.height * 0.3747886, size.width * 0.3287286, size.height * 0.3796443, size.width * 0.3249443, size.height * 0.3847086); path_1.lineTo(size.width * 0.3249443, size.height * 0.3847700); path_1.cubicTo( size.width * 0.3211614, size.height * 0.3898343, size.width * 0.3175929, size.height * 0.3950271, size.width * 0.3142629, size.height * 0.4003943); path_1.lineTo(size.width * 0.3142629, size.height * 0.4004557); path_1.cubicTo( size.width * 0.3109343, size.height * 0.4058229, size.width * 0.3078414, size.height * 0.4113571, size.width * 0.3049857, size.height * 0.4169957); path_1.cubicTo( size.width * 0.2992471, size.height * 0.4283186, size.width * 0.2944757, size.height * 0.4401157, size.width * 0.2907643, size.height * 0.4523357); path_1.cubicTo( size.width * 0.2889100, size.height * 0.4584371, size.width * 0.2873214, size.height * 0.4646143, size.width * 0.2860029, size.height * 0.4708900); path_1.lineTo(size.width * 0.2860029, size.height * 0.4709514); path_1.cubicTo( size.width * 0.2846914, size.height * 0.4772086, size.width * 0.2836500, size.height * 0.4835343, size.width * 0.2828900, size.height * 0.4899329); path_1.lineTo(size.width * 0.2828900, size.height * 0.4899943); path_1.cubicTo( size.width * 0.2813714, size.height * 0.5028114, size.width * 0.2809743, size.height * 0.5158657, size.width * 0.2817914, size.height * 0.5290557); path_1.lineTo(size.width * 0.2817914, size.height * 0.5291171); path_1.cubicTo( size.width * 0.2822014, size.height * 0.5357029, size.width * 0.2829057, size.height * 0.5423229, size.width * 0.2839286, size.height * 0.5489543); path_1.lineTo(size.width * 0.2839286, size.height * 0.5490143); path_1.cubicTo( size.width * 0.2839471, size.height * 0.5491386, size.width * 0.2839700, size.height * 0.5492571, size.width * 0.2839886, size.height * 0.5493814); path_1.cubicTo( size.width * 0.2856329, size.height * 0.5599086, size.width * 0.2882514, size.height * 0.5700871, size.width * 0.2913129, size.height * 0.5800214); path_1.cubicTo( size.width * 0.2918386, size.height * 0.5817271, size.width * 0.2922729, size.height * 0.5834600, size.width * 0.2928386, size.height * 0.5851471); path_1.cubicTo( size.width * 0.2960143, size.height * 0.5946171, size.width * 0.2998829, size.height * 0.6037400, size.width * 0.3042529, size.height * 0.6125529); path_1.cubicTo( size.width * 0.3051043, size.height * 0.6142700, size.width * 0.3059214, size.height * 0.6159886, size.width * 0.3068157, size.height * 0.6176800); path_1.cubicTo( size.width * 0.3113214, size.height * 0.6261943, size.width * 0.3163543, size.height * 0.6343143, size.width * 0.3218914, size.height * 0.6420929); path_1.cubicTo( size.width * 0.3231786, size.height * 0.6439029, size.width * 0.3245200, size.height * 0.6456371, size.width * 0.3258586, size.height * 0.6474043); path_1.cubicTo( size.width * 0.3316943, size.height * 0.6550957, size.width * 0.3378886, size.height * 0.6624829, size.width * 0.3446586, size.height * 0.6693157); path_1.cubicTo( size.width * 0.3449014, size.height * 0.6695614, size.width * 0.3450843, size.height * 0.6698643, size.width * 0.3453300, size.height * 0.6701086); path_1.lineTo(size.width * 0.6511771, size.height * 0.9759557); path_1.close(); Paint paint_1_fill = Paint()..style = PaintingStyle.fill; paint_1_fill.color = Color(0xffA51D1D).withOpacity(1.0); canvas.drawPath(path_1, paint_1_fill); Path path_2 = Path(); path_2.moveTo(size.width * 0.4998843, size.height * 0.2656543); path_2.cubicTo( size.width * 0.4978314, size.height * 0.2656871, size.width * 0.4958057, size.height * 0.2661229, size.width * 0.4939229, size.height * 0.2669371); path_2.cubicTo( size.width * 0.4920386, size.height * 0.2677529, size.width * 0.4903343, size.height * 0.2689300, size.width * 0.4889071, size.height * 0.2704043); path_2.cubicTo( size.width * 0.4874786, size.height * 0.2718771, size.width * 0.4863543, size.height * 0.2736186, size.width * 0.4855986, size.height * 0.2755257); path_2.cubicTo( size.width * 0.4848429, size.height * 0.2774343, size.width * 0.4844700, size.height * 0.2794714, size.width * 0.4845029, size.height * 0.2815243); path_2.lineTo(size.width * 0.4845029, size.height * 0.4065243); path_2.cubicTo( size.width * 0.4844729, size.height * 0.4085943, size.width * 0.4848557, size.height * 0.4106500, size.width * 0.4856286, size.height * 0.4125714); path_2.cubicTo( size.width * 0.4864000, size.height * 0.4144929, size.width * 0.4875471, size.height * 0.4162414, size.width * 0.4890000, size.height * 0.4177157); path_2.cubicTo( size.width * 0.4904543, size.height * 0.4191900, size.width * 0.4921871, size.height * 0.4203614, size.width * 0.4940971, size.height * 0.4211614); path_2.cubicTo( size.width * 0.4960071, size.height * 0.4219600, size.width * 0.4980571, size.height * 0.4223714, size.width * 0.5001271, size.height * 0.4223714); path_2.cubicTo( size.width * 0.5021986, size.height * 0.4223714, size.width * 0.5042486, size.height * 0.4219600, size.width * 0.5061586, size.height * 0.4211614); path_2.cubicTo( size.width * 0.5080686, size.height * 0.4203614, size.width * 0.5098014, size.height * 0.4191900, size.width * 0.5112557, size.height * 0.4177157); path_2.cubicTo( size.width * 0.5127086, size.height * 0.4162414, size.width * 0.5138557, size.height * 0.4144929, size.width * 0.5146271, size.height * 0.4125714); path_2.cubicTo( size.width * 0.5154000, size.height * 0.4106500, size.width * 0.5157814, size.height * 0.4085943, size.width * 0.5157529, size.height * 0.4065243); path_2.lineTo(size.width * 0.5157529, size.height * 0.2815243); path_2.cubicTo( size.width * 0.5157857, size.height * 0.2794314, size.width * 0.5153971, size.height * 0.2773529, size.width * 0.5146114, size.height * 0.2754129); path_2.cubicTo( size.width * 0.5138257, size.height * 0.2734729, size.width * 0.5126586, size.height * 0.2717100, size.width * 0.5111771, size.height * 0.2702300); path_2.cubicTo( size.width * 0.5096971, size.height * 0.2687500, size.width * 0.5079357, size.height * 0.2675814, size.width * 0.5059943, size.height * 0.2667957); path_2.cubicTo( size.width * 0.5040543, size.height * 0.2660100, size.width * 0.5019771, size.height * 0.2656214, size.width * 0.4998843, size.height * 0.2656543); path_2.close(); path_2.moveTo(size.width * 0.4380543, size.height * 0.3066100); path_2.lineTo(size.width * 0.4380543, size.height * 0.3066700); path_2.cubicTo( size.width * 0.4366443, size.height * 0.3067257, size.width * 0.4352486, size.height * 0.3069729, size.width * 0.4339043, size.height * 0.3074029); path_2.cubicTo( size.width * 0.3312671, size.height * 0.3399471, size.width * 0.2675329, size.height * 0.4426929, size.width * 0.2839414, size.height * 0.5491014); path_2.cubicTo( size.width * 0.3003486, size.height * 0.6555114, size.width * 0.3920871, size.height * 0.7342243, size.width * 0.4997614, size.height * 0.7343443); path_2.cubicTo( size.width * 0.6074357, size.height * 0.7343443, size.width * 0.6993686, size.height * 0.6559014, size.width * 0.7160086, size.height * 0.5495286); path_2.cubicTo( size.width * 0.7326500, size.height * 0.4431571, size.width * 0.6690986, size.height * 0.3402929, size.width * 0.5665343, size.height * 0.3075243); path_2.cubicTo( size.width * 0.5625843, size.height * 0.3062629, size.width * 0.5582957, size.height * 0.3066214, size.width * 0.5546100, size.height * 0.3085214); path_2.cubicTo( size.width * 0.5509243, size.height * 0.3104214, size.width * 0.5481457, size.height * 0.3137071, size.width * 0.5468829, size.height * 0.3176571); path_2.cubicTo( size.width * 0.5456200, size.height * 0.3216071, size.width * 0.5459786, size.height * 0.3258957, size.width * 0.5478771, size.height * 0.3295814); path_2.cubicTo( size.width * 0.5497771, size.height * 0.3332671, size.width * 0.5530629, size.height * 0.3360471, size.width * 0.5570129, size.height * 0.3373100); path_2.cubicTo( size.width * 0.6451143, size.height * 0.3654571, size.width * 0.6994186, size.height * 0.4533386, size.width * 0.6851257, size.height * 0.5447071); path_2.cubicTo( size.width * 0.6708314, size.height * 0.6360757, size.width * 0.5923129, size.height * 0.7031971, size.width * 0.4998229, size.height * 0.7030943); path_2.cubicTo( size.width * 0.4073314, size.height * 0.7030943, size.width * 0.3289186, size.height * 0.6357443, size.width * 0.3148257, size.height * 0.5443414); path_2.cubicTo( size.width * 0.3007314, size.height * 0.4529414, size.width * 0.3552000, size.height * 0.3651414, size.width * 0.4433657, size.height * 0.3371886); path_2.cubicTo( size.width * 0.4470314, size.height * 0.3360943, size.width * 0.4501700, size.height * 0.3336943, size.width * 0.4521843, size.height * 0.3304414); path_2.cubicTo( size.width * 0.4541986, size.height * 0.3271886, size.width * 0.4549500, size.height * 0.3233100, size.width * 0.4542957, size.height * 0.3195400); path_2.cubicTo( size.width * 0.4536414, size.height * 0.3157700, size.width * 0.4516257, size.height * 0.3123714, size.width * 0.4486329, size.height * 0.3099886); path_2.cubicTo( size.width * 0.4456386, size.height * 0.3076043, size.width * 0.4418757, size.height * 0.3064029, size.width * 0.4380543, size.height * 0.3066100); path_2.close(); Paint paint_2_fill = Paint()..style = PaintingStyle.fill; paint_2_fill.color = Colors.white.withOpacity(1.0); canvas.drawPath(path_2, paint_2_fill); } @override bool shouldRepaint(covariant CustomPainter oldDelegate) => false; }
0
mirrored_repositories/flutter_mockup_bloc/lib/utils/ui
mirrored_repositories/flutter_mockup_bloc/lib/utils/ui/dialog/trash_icon_painter.dart
// ignore_for_file: non_constant_identifier_names import 'package:flutter/material.dart'; class TrashIconPainter extends CustomPainter { const TrashIconPainter(); @override void paint(Canvas canvas, Size size) { Path path_0 = Path(); path_0.moveTo(size.width * 0.5000000, size.height); path_0.cubicTo(size.width * 0.7761429, size.height, size.width, size.height * 0.7761429, size.width, size.height * 0.5000000); path_0.cubicTo(size.width, size.height * 0.2238571, size.width * 0.7761429, 0, size.width * 0.5000000, 0); path_0.cubicTo(size.width * 0.2238571, 0, 0, size.height * 0.2238571, 0, size.height * 0.5000000); path_0.cubicTo(0, size.height * 0.7761429, size.width * 0.2238571, size.height, size.width * 0.5000000, size.height); path_0.close(); Paint paint_0_fill = Paint()..style = PaintingStyle.fill; paint_0_fill.color = Color(0xffF56868).withOpacity(1.0); canvas.drawPath(path_0, paint_0_fill); Path path_1 = Path(); path_1.moveTo(size.width * 0.9985943, size.height * 0.5376543); path_1.lineTo(size.width * 0.7314457, size.height * 0.2705057); path_1.lineTo(size.width * 0.6838943, size.height * 0.2431657); path_1.lineTo(size.width * 0.5999100, size.height * 0.1589700); path_1.lineTo(size.width * 0.4290371, size.height * 0.1796857); path_1.lineTo(size.width * 0.4000900, size.height * 0.2402329); path_1.lineTo(size.width * 0.2402343, size.height * 0.3601243); path_1.lineTo(size.width * 0.3606271, size.height * 0.4805171); path_1.lineTo(size.width * 0.3217600, size.height * 0.8410229); path_1.lineTo(size.width * 0.4803129, size.height * 0.9995757); path_1.cubicTo( size.width * 0.4868471, size.height * 0.9998300, size.width * 0.4934029, size.height * 0.9999971, size.width * 0.4999986, size.height * 0.9999971); path_1.cubicTo( size.width * 0.7634743, size.height * 0.9999971, size.width * 0.9793414, size.height * 0.7962043, size.width * 0.9985943, size.height * 0.5376543); path_1.close(); Paint paint_1_fill = Paint()..style = PaintingStyle.fill; paint_1_fill.color = Color(0xffF54C4C).withOpacity(1.0); canvas.drawPath(path_1, paint_1_fill); Path path_2 = Path(); path_2.moveTo(size.width * 0.4000843, size.height * 0.1589743); path_2.lineTo(size.width * 0.4000843, size.height * 0.2801986); path_2.lineTo(size.width * 0.5999043, size.height * 0.2801986); path_2.lineTo(size.width * 0.5999043, size.height * 0.1589743); path_2.lineTo(size.width * 0.4000843, size.height * 0.1589743); path_2.close(); path_2.moveTo(size.width * 0.5599400, size.height * 0.2402343); path_2.lineTo(size.width * 0.4400471, size.height * 0.2402343); path_2.lineTo(size.width * 0.4400471, size.height * 0.1989371); path_2.lineTo(size.width * 0.5599400, size.height * 0.1989371); path_2.lineTo(size.width * 0.5599400, size.height * 0.2402343); path_2.close(); Paint paint_2_fill = Paint()..style = PaintingStyle.fill; paint_2_fill.color = Color(0xff8B8892).withOpacity(1.0); canvas.drawPath(path_2, paint_2_fill); Path path_3 = Path(); path_3.moveTo(size.width * 0.5999100, size.height * 0.1589743); path_3.lineTo(size.width * 0.5999100, size.height * 0.2801986); path_3.lineTo(size.width * 0.5000000, size.height * 0.2801986); path_3.lineTo(size.width * 0.5000000, size.height * 0.2402343); path_3.lineTo(size.width * 0.5599457, size.height * 0.2402343); path_3.lineTo(size.width * 0.5599457, size.height * 0.1989371); path_3.lineTo(size.width * 0.5000000, size.height * 0.1989371); path_3.lineTo(size.width * 0.5000000, size.height * 0.1589743); path_3.lineTo(size.width * 0.5999100, size.height * 0.1589743); path_3.close(); Paint paint_3_fill = Paint()..style = PaintingStyle.fill; paint_3_fill.color = Color(0xff787780).withOpacity(1.0); canvas.drawPath(path_3, paint_3_fill); Path path_4 = Path(); path_4.moveTo(size.width * 0.2782086, size.height * 0.3201629); path_4.lineTo(size.width * 0.3217671, size.height * 0.8410257); path_4.lineTo(size.width * 0.6782471, size.height * 0.8410257); path_4.lineTo(size.width * 0.7218057, size.height * 0.3201629); path_4.lineTo(size.width * 0.2782086, size.height * 0.3201629); path_4.close(); Paint paint_4_fill = Paint()..style = PaintingStyle.fill; paint_4_fill.color = Color(0xffAEADB3).withOpacity(1.0); canvas.drawPath(path_4, paint_4_fill); Path path_5 = Path(); path_5.moveTo(size.width * 0.7217986, size.height * 0.3201629); path_5.lineTo(size.width * 0.6782400, size.height * 0.8410257); path_5.lineTo(size.width * 0.5000000, size.height * 0.8410257); path_5.lineTo(size.width * 0.5000000, size.height * 0.3201629); path_5.lineTo(size.width * 0.7217986, size.height * 0.3201629); path_5.close(); Paint paint_5_fill = Paint()..style = PaintingStyle.fill; paint_5_fill.color = Color(0xff8B8892).withOpacity(1.0); canvas.drawPath(path_5, paint_5_fill); Path path_6 = Path(); path_6.moveTo(size.width * 0.6598557, size.height * 0.2402343); path_6.lineTo(size.width * 0.3401443, size.height * 0.2402343); path_6.cubicTo( size.width * 0.2849943, size.height * 0.2402343, size.width * 0.2402343, size.height * 0.2849943, size.width * 0.2402343, size.height * 0.3401443); path_6.lineTo(size.width * 0.2402343, size.height * 0.3601271); path_6.lineTo(size.width * 0.7597657, size.height * 0.3601271); path_6.lineTo(size.width * 0.7597657, size.height * 0.3401443); path_6.cubicTo( size.width * 0.7597657, size.height * 0.2849943, size.width * 0.7150057, size.height * 0.2402343, size.width * 0.6598557, size.height * 0.2402343); path_6.close(); Paint paint_6_fill = Paint()..style = PaintingStyle.fill; paint_6_fill.color = Color(0xffE5E5E5).withOpacity(1.0); canvas.drawPath(path_6, paint_6_fill); Path path_7 = Path(); path_7.moveTo(size.width * 0.5199871, size.height * 0.4400571); path_7.lineTo(size.width * 0.4800229, size.height * 0.4400571); path_7.lineTo(size.width * 0.4800229, size.height * 0.7610914); path_7.lineTo(size.width * 0.5199871, size.height * 0.7610914); path_7.lineTo(size.width * 0.5199871, size.height * 0.4400571); path_7.close(); Paint paint_7_fill = Paint()..style = PaintingStyle.fill; paint_7_fill.color = Color(0xffE5E5E5).withOpacity(1.0); canvas.drawPath(path_7, paint_7_fill); Path path_8 = Path(); path_8.moveTo(size.width * 0.5999257, size.height * 0.4400571); path_8.lineTo(size.width * 0.5599614, size.height * 0.4400571); path_8.lineTo(size.width * 0.5599614, size.height * 0.7610914); path_8.lineTo(size.width * 0.5999257, size.height * 0.7610914); path_8.lineTo(size.width * 0.5999257, size.height * 0.4400571); path_8.close(); Paint paint_8_fill = Paint()..style = PaintingStyle.fill; paint_8_fill.color = Color(0xffC8C6CD).withOpacity(1.0); canvas.drawPath(path_8, paint_8_fill); Path path_9 = Path(); path_9.moveTo(size.width * 0.4400757, size.height * 0.4400571); path_9.lineTo(size.width * 0.4001114, size.height * 0.4400571); path_9.lineTo(size.width * 0.4001114, size.height * 0.7610914); path_9.lineTo(size.width * 0.4400757, size.height * 0.7610914); path_9.lineTo(size.width * 0.4400757, size.height * 0.4400571); path_9.close(); Paint paint_9_fill = Paint()..style = PaintingStyle.fill; paint_9_fill.color = Color(0xffE5E5E5).withOpacity(1.0); canvas.drawPath(path_9, paint_9_fill); Path path_10 = Path(); path_10.moveTo(size.width * 0.5199829, size.height * 0.4400571); path_10.lineTo(size.width * 0.5000000, size.height * 0.4400571); path_10.lineTo(size.width * 0.5000000, size.height * 0.7610914); path_10.lineTo(size.width * 0.5199829, size.height * 0.7610914); path_10.lineTo(size.width * 0.5199829, size.height * 0.4400571); path_10.close(); Paint paint_10_fill = Paint()..style = PaintingStyle.fill; paint_10_fill.color = Color(0xffC8C6CD).withOpacity(1.0); canvas.drawPath(path_10, paint_10_fill); Path path_11 = Path(); path_11.moveTo(size.width * 0.7597657, size.height * 0.3401443); path_11.lineTo(size.width * 0.7597657, size.height * 0.3601271); path_11.lineTo(size.width * 0.5000000, size.height * 0.3601271); path_11.lineTo(size.width * 0.5000000, size.height * 0.2402343); path_11.lineTo(size.width * 0.6598557, size.height * 0.2402343); path_11.cubicTo( size.width * 0.7150057, size.height * 0.2402343, size.width * 0.7597657, size.height * 0.2849943, size.width * 0.7597657, size.height * 0.3401443); path_11.close(); Paint paint_11_fill = Paint()..style = PaintingStyle.fill; paint_11_fill.color = Color(0xffC8C6CD).withOpacity(1.0); canvas.drawPath(path_11, paint_11_fill); } @override bool shouldRepaint(covariant CustomPainter oldDelegate) => false; }
0
mirrored_repositories/flutter_mockup_bloc/lib/utils/ui
mirrored_repositories/flutter_mockup_bloc/lib/utils/ui/dialog/check_icon_painter.dart
// ignore_for_file: non_constant_identifier_names import 'package:flutter/material.dart'; class CheckIconPainter extends CustomPainter { const CheckIconPainter(); @override void paint(Canvas canvas, Size size) { Path path_0 = Path(); path_0.moveTo(size.width * 0.5000000, size.height); path_0.cubicTo(size.width * 0.7761429, size.height, size.width, size.height * 0.7761429, size.width, size.height * 0.5000000); path_0.cubicTo(size.width, size.height * 0.2238571, size.width * 0.7761429, 0, size.width * 0.5000000, 0); path_0.cubicTo(size.width * 0.2238571, 0, 0, size.height * 0.2238571, 0, size.height * 0.5000000); path_0.cubicTo(0, size.height * 0.7761429, size.width * 0.2238571, size.height, size.width * 0.5000000, size.height); path_0.close(); Paint paint_0_fill = Paint()..style = PaintingStyle.fill; paint_0_fill.color = Color(0xff32BA7C).withOpacity(1.0); canvas.drawPath(path_0, paint_0_fill); Path path_1 = Path(); path_1.moveTo(size.width * 0.3722371, size.height * 0.7255543); path_1.lineTo(size.width * 0.6293357, size.height * 0.9826514); path_1.cubicTo( size.width * 0.8422686, size.height * 0.9258686, size.width * 0.9999986, size.height * 0.7318629, size.width * 0.9999986, size.height * 0.5000014); path_1.cubicTo( size.width * 0.9999986, size.height * 0.4952700, size.width * 0.9999986, size.height * 0.4905371, size.width * 0.9999986, size.height * 0.4858057); path_1.lineTo(size.width * 0.7981057, size.height * 0.2996857); path_1.lineTo(size.width * 0.3722371, size.height * 0.7255543); path_1.close(); Paint paint_1_fill = Paint()..style = PaintingStyle.fill; paint_1_fill.color = Color(0xff0AA06E).withOpacity(1.0); canvas.drawPath(path_1, paint_1_fill); Path path_2 = Path(); path_2.moveTo(size.width * 0.5126343, size.height * 0.6119914); path_2.cubicTo( size.width * 0.5347157, size.height * 0.6340743, size.width * 0.5347157, size.height * 0.6719286, size.width * 0.5126343, size.height * 0.6940100); path_2.lineTo(size.width * 0.4668929, size.height * 0.7397514); path_2.cubicTo( size.width * 0.4448100, size.height * 0.7618343, size.width * 0.4069557, size.height * 0.7618343, size.width * 0.3848729, size.height * 0.7397514); path_2.lineTo(size.width * 0.1845586, size.height * 0.5378586); path_2.cubicTo( size.width * 0.1624757, size.height * 0.5157771, size.width * 0.1624757, size.height * 0.4779229, size.width * 0.1845586, size.height * 0.4558400); path_2.lineTo(size.width * 0.2303000, size.height * 0.4100986); path_2.cubicTo( size.width * 0.2523814, size.height * 0.3880171, size.width * 0.2902357, size.height * 0.3880171, size.width * 0.3123186, size.height * 0.4100986); path_2.lineTo(size.width * 0.5126343, size.height * 0.6119914); path_2.close(); Paint paint_2_fill = Paint()..style = PaintingStyle.fill; paint_2_fill.color = Colors.white.withOpacity(1.0); canvas.drawPath(path_2, paint_2_fill); Path path_3 = Path(); path_3.moveTo(size.width * 0.6877271, size.height * 0.2634086); path_3.cubicTo( size.width * 0.7098100, size.height * 0.2413271, size.width * 0.7476643, size.height * 0.2413271, size.width * 0.7697471, size.height * 0.2634086); path_3.lineTo(size.width * 0.8154871, size.height * 0.3091500); path_3.cubicTo( size.width * 0.8375700, size.height * 0.3312314, size.width * 0.8375700, size.height * 0.3690871, size.width * 0.8154871, size.height * 0.3911686); path_3.lineTo(size.width * 0.4684843, size.height * 0.7365943); path_3.cubicTo( size.width * 0.4464029, size.height * 0.7586771, size.width * 0.4085471, size.height * 0.7586771, size.width * 0.3864657, size.height * 0.7365943); path_3.lineTo(size.width * 0.3407243, size.height * 0.6908529); path_3.cubicTo( size.width * 0.3186429, size.height * 0.6687714, size.width * 0.3186429, size.height * 0.6309171, size.width * 0.3407243, size.height * 0.6088343); path_3.lineTo(size.width * 0.6877271, size.height * 0.2634086); path_3.close(); Paint paint_3_fill = Paint()..style = PaintingStyle.fill; paint_3_fill.color = Colors.white.withOpacity(1.0); canvas.drawPath(path_3, paint_3_fill); } @override bool shouldRepaint(covariant CustomPainter oldDelegate) => false; }
0
mirrored_repositories/flutter_mockup_bloc/lib/utils/ui
mirrored_repositories/flutter_mockup_bloc/lib/utils/ui/dialog/base_custom_dialog.dart
import 'package:flutter/material.dart'; import 'package:flutter_mockup_bloc/presentation/widgets/common/load_image.dart'; import 'package:flutter_mockup_bloc/resource/app_colors.dart'; import 'package:flutter_mockup_bloc/resource/app_constant.dart'; import 'package:flutter_mockup_bloc/resource/app_text_styles.dart'; import 'package:flutter_mockup_bloc/resource/dimens.dart'; import 'package:flutter_mockup_bloc/resource/gaps.dart'; class BaseCustomDialog extends StatelessWidget { const BaseCustomDialog({ required this.title, this.titleSubmit = 'OK', required this.onPressed, this.hiddenTitle : false, this.isShowCancel : false, required this.child }) : super(); final String title; final String titleSubmit; final Function onPressed; final Widget child; final bool hiddenTitle; final bool isShowCancel; @override Widget build(BuildContext context) { final _width = MediaQuery.of(context).size.width; var dialogTitle = Visibility( visible: !hiddenTitle, child: Padding( padding: const EdgeInsets.only(bottom: 8.0), child: Text( hiddenTitle ? '' : title, style: AppTextStyles.dialogTitle, ), ), ); var bottomButton = Row( children: <Widget>[ _DialogButton( text: 'Hủy', textColor: AppColors.text_gray, onPressed: () => Navigator.pop(context), ), const SizedBox( height: 40.0, width: 0.6, child: const VerticalDivider(), ), _DialogButton( text: titleSubmit, textColor: AppColors.text, onPressed: onPressed(), ), ], ); var bottomButtonNotCancel = Row( children: <Widget>[ _DialogButton( text: titleSubmit, textColor: AppColors.primary, onPressed: onPressed(), ), ], ); var body = Material( borderRadius: BorderRadius.circular(5.0), child: Column( mainAxisSize: MainAxisSize.min, children: <Widget>[ Gaps.vGap24, LoadImage(AppConstants.logo_app, width: _width / 4, height: _width / 4, fit: BoxFit.contain,), // IconSVG(IconSVGPath.ic_logo, _width / 4, _width / 4, null), Gaps.vGap20, // dialogTitle, Flexible(child: child), Gaps.vGap8, Gaps.line, isShowCancel ? bottomButton : bottomButtonNotCancel, ], ), ); return AnimatedPadding( padding: MediaQuery.of(context).viewInsets + const EdgeInsets.symmetric(horizontal: 20.0, vertical: 24.0), duration: const Duration(milliseconds: 120), curve: Curves.easeInCubic, child: MediaQuery.removeViewInsets( removeLeft: true, removeTop: true, removeRight: true, removeBottom: true, context: context, child: Center( child: SizedBox( width: 270.0, child: body, ), ), ), ); } } class _DialogButton extends StatelessWidget { const _DialogButton({ required this.text, required this.textColor, required this.onPressed, }): super(); final String text; final Color textColor; final Function()? onPressed; @override Widget build(BuildContext context) { return Expanded( child: SizedBox( height: 40.0, child: FlatButton( child: Text( text, style: TextStyle(fontSize: Dimens.font_sp14), ), textColor: textColor, onPressed: onPressed, ), ), ); } }
0
mirrored_repositories/flutter_mockup_bloc/lib/utils/ui
mirrored_repositories/flutter_mockup_bloc/lib/utils/ui/dialog/dialog_action.dart
import 'package:flutter/material.dart'; class DialogAction{ } Future<Object?> showTransparentDialog<T>({ required BuildContext context, bool barrierDismissible = true, required WidgetBuilder builder, }) { final ThemeData? theme = Theme.of(context); return showGeneralDialog( context: context, pageBuilder: (BuildContext buildContext, Animation<double> animation, Animation<double> secondaryAnimation) { final Widget pageChild = Builder(builder: builder); return SafeArea( child: Builder( builder: (BuildContext context) { return theme != null ? Theme(data: theme, child: pageChild) : pageChild; } ), ); }, barrierDismissible: barrierDismissible, barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel, barrierColor: const Color(0x00FFFFFF), transitionDuration: const Duration(milliseconds: 150), transitionBuilder: _buildMaterialDialogTransitions, ); } Widget _buildMaterialDialogTransitions(BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, Widget child) { return FadeTransition( opacity: CurvedAnimation( parent: animation, curve: Curves.easeOut, ), child: child, ); }
0
mirrored_repositories/flutter_mockup_bloc/lib/utils/ui
mirrored_repositories/flutter_mockup_bloc/lib/utils/ui/dialog/x_icon_painter.dart
// ignore_for_file: non_constant_identifier_names import 'package:flutter/material.dart'; class XIconPainter extends CustomPainter { const XIconPainter(); @override void paint(Canvas canvas, Size size) { Path path_0 = Path(); path_0.moveTo(size.width * 0.5000000, size.height); path_0.cubicTo(size.width * 0.7761429, size.height, size.width, size.height * 0.7761429, size.width, size.height * 0.5000000); path_0.cubicTo(size.width, size.height * 0.2238571, size.width * 0.7761429, 0, size.width * 0.5000000, 0); path_0.cubicTo(size.width * 0.2238571, 0, 0, size.height * 0.2238571, 0, size.height * 0.5000000); path_0.cubicTo(0, size.height * 0.7761429, size.width * 0.2238571, size.height, size.width * 0.5000000, size.height); path_0.close(); Paint paint_0_fill = Paint()..style = PaintingStyle.fill; paint_0_fill.color = Color(0xffE21B1B).withOpacity(1.0); canvas.drawPath(path_0, paint_0_fill); Path path_1 = Path(); path_1.moveTo(size.width * 0.9966300, size.height * 0.5572343); path_1.lineTo(size.width * 0.7185686, size.height * 0.2791714); path_1.lineTo(size.width * 0.2934429, size.height * 0.7199371); path_1.lineTo(size.width * 0.5686929, size.height * 0.9951871); path_1.cubicTo( size.width * 0.7936457, size.height * 0.9642500, size.width * 0.9708029, size.height * 0.7837657, size.width * 0.9966300, size.height * 0.5572343); path_1.close(); Paint paint_1_fill = Paint()..style = PaintingStyle.fill; paint_1_fill.color = Color(0xffC40606).withOpacity(1.0); canvas.drawPath(path_1, paint_1_fill); Path path_2 = Path(); path_2.moveTo(size.width * 0.6921629, size.height * 0.7256557); path_2.cubicTo( size.width * 0.6821629, size.height * 0.7256557, size.width * 0.6721771, size.height * 0.7218429, size.width * 0.6645371, size.height * 0.7142186); path_2.lineTo(size.width * 0.2859743, size.height * 0.3356400); path_2.cubicTo( size.width * 0.2707086, size.height * 0.3203743, size.width * 0.2707086, size.height * 0.2956557, size.width * 0.2859743, size.height * 0.2804057); path_2.cubicTo( size.width * 0.3012400, size.height * 0.2651557, size.width * 0.3259586, size.height * 0.2651400, size.width * 0.3412086, size.height * 0.2804057); path_2.lineTo(size.width * 0.7197871, size.height * 0.6589843); path_2.cubicTo( size.width * 0.7350529, size.height * 0.6742500, size.width * 0.7350529, size.height * 0.6989686, size.width * 0.7197871, size.height * 0.7142186); path_2.cubicTo( size.width * 0.7121471, size.height * 0.7218429, size.width * 0.7021629, size.height * 0.7256557, size.width * 0.6921629, size.height * 0.7256557); path_2.close(); Paint paint_2_fill = Paint()..style = PaintingStyle.fill; paint_2_fill.color = Colors.white.withOpacity(1.0); canvas.drawPath(path_2, paint_2_fill); Path path_3 = Path(); path_3.moveTo(size.width * 0.3135714, size.height * 0.7256557); path_3.cubicTo( size.width * 0.3035714, size.height * 0.7256557, size.width * 0.2935871, size.height * 0.7218429, size.width * 0.2859471, size.height * 0.7142171); path_3.cubicTo( size.width * 0.2706814, size.height * 0.6989514, size.width * 0.2706814, size.height * 0.6742329, size.width * 0.2859471, size.height * 0.6589829); path_3.lineTo(size.width * 0.6645243, size.height * 0.2804043); path_3.cubicTo( size.width * 0.6797900, size.height * 0.2651400, size.width * 0.7045100, size.height * 0.2651400, size.width * 0.7197600, size.height * 0.2804043); path_3.cubicTo( size.width * 0.7350086, size.height * 0.2956700, size.width * 0.7350243, size.height * 0.3203900, size.width * 0.7197600, size.height * 0.3356400); path_3.lineTo(size.width * 0.3411971, size.height * 0.7142171); path_3.cubicTo( size.width * 0.3335714, size.height * 0.7218429, size.width * 0.3235714, size.height * 0.7256557, size.width * 0.3135714, size.height * 0.7256557); path_3.close(); Paint paint_3_fill = Paint()..style = PaintingStyle.fill; paint_3_fill.color = Colors.white.withOpacity(1.0); canvas.drawPath(path_3, paint_3_fill); } @override bool shouldRepaint(covariant CustomPainter oldDelegate) => false; }
0
mirrored_repositories/flutter_mockup_bloc/lib/utils
mirrored_repositories/flutter_mockup_bloc/lib/utils/web/app_configurator.dart
void configureWebApp() { //noop because this should only be used in web }
0
mirrored_repositories/flutter_mockup_bloc/lib/utils
mirrored_repositories/flutter_mockup_bloc/lib/utils/web/app_configurator_web.dart
import 'package:flutter_web_plugins/flutter_web_plugins.dart'; void configureWebApp() { setUrlStrategy(PathUrlStrategy()); }
0
mirrored_repositories/flutter_mockup_bloc
mirrored_repositories/flutter_mockup_bloc/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility that Flutter provides. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_mockup_bloc/app.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_mockup_bloc/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/riverpod_tutorial
mirrored_repositories/riverpod_tutorial/lib/main.dart
import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'src/app.dart'; void main() { runApp(ProviderScope(child: App())); }
0
mirrored_repositories/riverpod_tutorial/lib
mirrored_repositories/riverpod_tutorial/lib/src/app.dart
import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'utils/themes.dart'; import 'utils/routers.dart'; class App extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( title: 'Riverpod', theme: themeData(Themes.lightTheme), onGenerateRoute: Routers.generateRoute, initialRoute: '/', ); } ThemeData themeData(ThemeData theme) { return theme.copyWith( textTheme: GoogleFonts.sourceSansProTextTheme( theme.textTheme, ), ); } }
0
mirrored_repositories/riverpod_tutorial/lib/src/view
mirrored_repositories/riverpod_tutorial/lib/src/view/widgets/custom_card.dart
import 'package:flutter/material.dart'; import '../../utils/themes.dart'; class CustomCard extends StatelessWidget { final Widget child; final VoidCallback onTap; final BorderRadius borderRadius; final bool elevated; CustomCard({ required this.child, required this.onTap, required this.borderRadius, this.elevated = true, }); @override Widget build(BuildContext context) { return Container( decoration: elevated ? BoxDecoration( borderRadius: borderRadius, color: Theme.of(context).cardColor, boxShadow: [ Themes.cardShadow, ], ) : BoxDecoration( borderRadius: borderRadius, color: Theme.of(context).cardColor, ), child: Material( type: MaterialType.transparency, borderRadius: borderRadius, child: InkWell( borderRadius: borderRadius, onTap: onTap, child: child, ), ), ); } }
0
mirrored_repositories/riverpod_tutorial/lib/src/view
mirrored_repositories/riverpod_tutorial/lib/src/view/widgets/body_builder.dart
import 'package:flutter/material.dart'; import '../../viewmodels/home_viewmodel.dart'; import 'errors/error_widget.dart'; class BodyBuilder extends StatelessWidget { final APIRequestStatus apiRequestStatus; final Widget child; final Widget loadingWidget; final VoidCallback reload; BodyBuilder( {Key? key, required this.apiRequestStatus, required this.child, required this.loadingWidget, required this.reload}) : super(key: key); @override Widget build(BuildContext context) { return _buildBody(); } Widget _buildBody() { switch (apiRequestStatus) { case APIRequestStatus.loading: return loadingWidget; case APIRequestStatus.unInitialized: return loadingWidget; case APIRequestStatus.connectionError: return MyErrorWidget(refreshCallBack: reload, isConnection: true); case APIRequestStatus.error: return MyErrorWidget(refreshCallBack: reload); case APIRequestStatus.loaded: return child; default: return loadingWidget; } } }
0
mirrored_repositories/riverpod_tutorial/lib/src/view
mirrored_repositories/riverpod_tutorial/lib/src/view/widgets/character_card.dart
import 'package:flutter/material.dart'; import '../../data/models/character.dart'; import 'custom_card.dart'; class CharacterCard extends StatelessWidget { final Character? character; CharacterCard({required this.character}); @override Widget build(BuildContext context) { final double width = MediaQuery.of(context).size.width; final double height = MediaQuery.of(context).size.height; return CustomCard( onTap: () {}, borderRadius: BorderRadius.all(Radius.circular(10.0)), child: Container( width: width, height: height * 0.82, child: ListView.builder( itemCount: character!.results!.length, itemBuilder: (context, index) { return Container( margin: EdgeInsets.only(bottom: 5), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ ClipRRect( borderRadius: BorderRadius.only( topLeft: Radius.circular(10.0), bottomLeft: Radius.circular(10.0), ), child: Image.network( character!.results![index].image!, height: 145.0, ), ), SizedBox( width: 10.0, ), Padding( padding: const EdgeInsets.symmetric(vertical: 10.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( character!.results![index].name!, style: TextStyle( fontWeight: FontWeight.bold, fontSize: 18.0, ), ), Row( children: [ Container( height: 7.0, width: 7.0, decoration: BoxDecoration( color: statusColor( character!.results![index].status!), shape: BoxShape.circle, ), ), SizedBox(width: 5.0), Text( '${character!.results![index].status!} - ${character!.results![index].species!}', style: TextStyle( fontWeight: FontWeight.w500, fontSize: 14.0, ), ), ], ), SizedBox(height: 5.0), buildInfo('Last known location:', character!.results![index].origin!.name), SizedBox(height: 5.0), buildInfo('Origin:', character!.results![index].location!.name), ], ), ), ], ), ); }, ), ), ); } buildInfo(title, content) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( title, style: TextStyle( fontWeight: FontWeight.w500, fontSize: 14.0, color: Colors.grey, ), ), Text( content, style: TextStyle( fontWeight: FontWeight.w500, fontSize: 14.0, ), ), ], ); } Color? statusColor(status) { switch (status.toLowerCase()) { case 'alive': return Colors.green[300]; case 'dead': return Colors.red; case 'unknown': return Colors.blueGrey; default: return Colors.blueGrey; } } }
0
mirrored_repositories/riverpod_tutorial/lib/src/view
mirrored_repositories/riverpod_tutorial/lib/src/view/widgets/LocationCard.dart
import 'package:flutter/material.dart'; import '../../../src/data/models/location.dart'; import 'custom_card.dart'; class LocationCard extends StatelessWidget { final Location? location; LocationCard({required this.location}); @override Widget build(BuildContext context) { final double width = MediaQuery.of(context).size.width; final double height = MediaQuery.of(context).size.height; return CustomCard( onTap: () {}, borderRadius: BorderRadius.all(Radius.circular(10.0)), child: Container( width: width, height: height * 0.82, child: ListView.builder( itemCount: location!.results!.length, itemBuilder: (context, index) { return Container( margin: EdgeInsets.only(bottom: 5), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ ClipRRect( borderRadius: BorderRadius.only( topLeft: Radius.circular(10.0), bottomLeft: Radius.circular(10.0), ), child: Text( location!.results![index].id!.toString(), style: TextStyle( fontWeight: FontWeight.bold, fontSize: 18.0, ), ), ), SizedBox( width: 10.0, ), Padding( padding: const EdgeInsets.symmetric(vertical: 10.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( location!.results![index].name!, style: TextStyle( fontWeight: FontWeight.bold, fontSize: 18.0, ), ), Row( children: [ Text( '${location!.results![index].type!}', style: TextStyle( fontWeight: FontWeight.w500, fontSize: 14.0, ), ), SizedBox(width: 5.0), Text( '${location!.results![index].dimension!}', style: TextStyle( fontWeight: FontWeight.w500, fontSize: 14.0, ), ), ], ), SizedBox(height: 5.0), buildInfo('Total Residents:', location!.results![index].residents!.length), SizedBox(height: 5.0), ], ), ), ], ), ); }, ), ), ); } buildInfo(title, content) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( title, style: TextStyle( fontWeight: FontWeight.w500, fontSize: 14.0, color: Colors.grey, ), ), Text( content, style: TextStyle( fontWeight: FontWeight.w500, fontSize: 14.0, ), ), ], ); } Color? statusColor(status) { switch (status.toLowerCase()) { case 'alive': return Colors.green[300]; case 'dead': return Colors.red; case 'unknown': return Colors.blueGrey; default: return Colors.blueGrey; } } }
0
mirrored_repositories/riverpod_tutorial/lib/src/view/widgets
mirrored_repositories/riverpod_tutorial/lib/src/view/widgets/errors/error_widget.dart
import 'package:flutter/material.dart'; class MyErrorWidget extends StatelessWidget { final VoidCallback refreshCallBack; final bool isConnection; MyErrorWidget({required this.refreshCallBack, this.isConnection = false}); @override Widget build(BuildContext context) { return Container( alignment: Alignment.center, margin: EdgeInsets.symmetric(horizontal: 20.0), child: Column( mainAxisSize: MainAxisSize.min, children: <Widget>[ Text( '😔', style: TextStyle( fontSize: 20.0, ), ), Container( margin: EdgeInsets.symmetric(vertical: 14.0), child: Text( '${getErrorText(context)}', textAlign: TextAlign.center, style: TextStyle( color: Theme.of(context).textTheme.titleLarge!.color, fontSize: 17.0, fontWeight: FontWeight.w600, ), ), ), Container( child: ElevatedButton( onPressed: refreshCallBack, style: ElevatedButton.styleFrom( backgroundColor: Theme.of(context).colorScheme.primary, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(5.0), ), ), child: Text( 'Try again', style: TextStyle( color: Colors.white, fontSize: 15.0, fontWeight: FontWeight.bold, ), ), ), ) ], ), ); } getErrorText(BuildContext context) { if (isConnection) { return 'Connection problems'; } else { return 'An error occurred'; } } }
0
mirrored_repositories/riverpod_tutorial/lib/src/view
mirrored_repositories/riverpod_tutorial/lib/src/view/screens/home_screen.dart
import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import '../../utils/constants.dart'; import '../../utils/providers.dart'; class HomeScreen extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { var viewModel = ref.watch(homeProvider); return Scaffold( appBar: AppBar( title: Text("$appName"), ), bottomNavigationBar: BottomNavigationBar( currentIndex: viewModel.selectedMenu, onTap: (index) { viewModel.changeMenu(index); }, items: viewModel.buildThreeItems(), ), body: viewModel.pages[viewModel.selectedMenu], ); } }
0
mirrored_repositories/riverpod_tutorial/lib/src/view
mirrored_repositories/riverpod_tutorial/lib/src/view/screens/character_screen.dart
import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import '../../data/models/character.dart'; import '../../utils/providers.dart'; import '../widgets/body_builder.dart'; import '../widgets/character_card.dart'; class CharacterScreen extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { var viewModel = ref.watch(homeProvider); return BodyBuilder( apiRequestStatus: viewModel.requestStatus, loadingWidget: Center(child: CircularProgressIndicator()), reload: () => viewModel.getCharacters(), child: ListView.builder( physics: ClampingScrollPhysics(), itemCount: 1, itemBuilder: (BuildContext context, int index) { if (viewModel.characters?.results?.isNotEmpty == true) { Character? character = viewModel .characters; //hilangkan "as Character?" jika tidak bisa return Padding( padding: const EdgeInsets.symmetric( vertical: 5.0, horizontal: 10.0, ), child: CharacterCard(character: character), ); } else { return Center(child: CircularProgressIndicator()); } }, ), ); } }
0
mirrored_repositories/riverpod_tutorial/lib/src/view
mirrored_repositories/riverpod_tutorial/lib/src/view/screens/location_screen.dart
import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:riverpod_tutorial/src/data/models/location.dart'; import 'package:riverpod_tutorial/src/view/widgets/LocationCard.dart'; import '../../utils/providers.dart'; import '../widgets/body_builder.dart'; class LocationScreen extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { var viewModel = ref.watch(homeProvider); return BodyBuilder( apiRequestStatus: viewModel.requestStatus, loadingWidget: Center(child: CircularProgressIndicator()), reload: () => viewModel.getLocation(), child: ListView.builder( physics: ClampingScrollPhysics(), itemCount: 1, itemBuilder: (BuildContext context, int index) { if (viewModel.locations?.results?.isNotEmpty == true) { Location? location = viewModel.locations; //hilangkan "as Character?" jika tidak bisa return Padding( padding: const EdgeInsets.symmetric( vertical: 5.0, horizontal: 10.0, ), child: LocationCard(location: location), ); } else { return Center( child: CircularProgressIndicator(), ); } }, ), ); } }
0
mirrored_repositories/riverpod_tutorial/lib/src/view
mirrored_repositories/riverpod_tutorial/lib/src/view/screens/splash_screen.dart
import 'dart:async'; import 'package:flutter/material.dart'; import 'home_screen.dart'; import '../../utils/navigate.dart'; class SplashScreen extends StatefulWidget { @override _SplashScreenState createState() => _SplashScreenState(); } class _SplashScreenState extends State<SplashScreen> { startTimeout() { return new Timer(Duration(seconds: 2), handleTimeout); } void handleTimeout() { changeScreen(); } changeScreen() async { Navigate.pushPageReplacement(context, HomeScreen()); } @override void initState() { super.initState(); startTimeout(); } @override Widget build(BuildContext context) { return Scaffold( body: Center( child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ // Image.asset( // "assets/images/black_icon.png", // color: Theme.of(context).textTheme.titleLarge!.color, // height: 150, // width: 150, // ), Text("RIVERPOD API TUTORIAL") ], ), ), ); } }
0
mirrored_repositories/riverpod_tutorial/lib/src/view
mirrored_repositories/riverpod_tutorial/lib/src/view/screens/detail_screen.dart
import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; class DetailScreen extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { return Scaffold( body: Container( child: Text("screen2"), ), ); } }
0
mirrored_repositories/riverpod_tutorial/lib/src/data
mirrored_repositories/riverpod_tutorial/lib/src/data/models/location.dart
class Location { Info? info; List<Results>? results; Location({this.info, this.results}); Location.fromJson(Map<String, dynamic> json) { info = json['info'] != null ? new Info.fromJson(json['info']) : null; if (json['results'] != null) { results = <Results>[]; json['results'].forEach((v) { results!.add(new Results.fromJson(v)); }); } } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); if (this.info != null) { data['info'] = this.info!.toJson(); } if (this.results != null) { data['results'] = this.results!.map((v) => v.toJson()).toList(); } return data; } } class Info { int? count; int? pages; String? next; Null prev; Info({this.count, this.pages, this.next, this.prev}); Info.fromJson(Map<String, dynamic> json) { count = json['count']; pages = json['pages']; next = json['next']; prev = json['prev']; } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['count'] = this.count; data['pages'] = this.pages; data['next'] = this.next; data['prev'] = this.prev; return data; } } class Results { int? id; String? name; String? type; String? dimension; List<String>? residents; String? url; String? created; Results( {this.id, this.name, this.type, this.dimension, this.residents, this.url, this.created}); Results.fromJson(Map<String, dynamic> json) { id = json['id']; name = json['name']; type = json['type']; dimension = json['dimension']; residents = json['residents'].cast<String>(); url = json['url']; created = json['created']; } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['id'] = this.id; data['name'] = this.name; data['type'] = this.type; data['dimension'] = this.dimension; data['residents'] = this.residents; data['url'] = this.url; data['created'] = this.created; return data; } }
0
mirrored_repositories/riverpod_tutorial/lib/src/data
mirrored_repositories/riverpod_tutorial/lib/src/data/models/character.dart
class Character { Info? info; List<Results>? results; Character({this.info, this.results}); Character.fromJson(Map<String, dynamic> json) { info = json['info'] != null ? new Info.fromJson(json['info']) : null; if (json['results'] != null) { results = <Results>[]; json['results'].forEach((v) { results!.add(new Results.fromJson(v)); }); } } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); if (this.info != null) { data['info'] = this.info!.toJson(); } if (this.results != null) { data['results'] = this.results!.map((v) => v.toJson()).toList(); } return data; } } class Info { int? count; int? pages; String? next; Null prev; Info({this.count, this.pages, this.next, this.prev}); Info.fromJson(Map<String, dynamic> json) { count = json['count']; pages = json['pages']; next = json['next']; prev = json['prev']; } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['count'] = this.count; data['pages'] = this.pages; data['next'] = this.next; data['prev'] = this.prev; return data; } } class Results { int? id; String? name; String? status; String? species; String? type; String? gender; Origin? origin; Origin? location; String? image; List<String>? episode; String? url; String? created; Results( {this.id, this.name, this.status, this.species, this.type, this.gender, this.origin, this.location, this.image, this.episode, this.url, this.created}); Results.fromJson(Map<String, dynamic> json) { id = json['id']; name = json['name']; status = json['status']; species = json['species']; type = json['type']; gender = json['gender']; origin = json['origin'] != null ? new Origin.fromJson(json['origin']) : null; location = json['location'] != null ? new Origin.fromJson(json['location']) : null; image = json['image']; episode = json['episode'].cast<String>(); url = json['url']; created = json['created']; } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['id'] = this.id; data['name'] = this.name; data['status'] = this.status; data['species'] = this.species; data['type'] = this.type; data['gender'] = this.gender; if (this.origin != null) { data['origin'] = this.origin!.toJson(); } if (this.location != null) { data['location'] = this.location!.toJson(); } data['image'] = this.image; data['episode'] = this.episode; data['url'] = this.url; data['created'] = this.created; return data; } } class Origin { String? name; String? url; Origin({this.name, this.url}); Origin.fromJson(Map<String, dynamic> json) { name = json['name']; url = json['url']; } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['name'] = this.name; data['url'] = this.url; return data; } }
0
mirrored_repositories/riverpod_tutorial/lib/src/data
mirrored_repositories/riverpod_tutorial/lib/src/data/models/episode.dart
class Episode { Info? info; List<Results>? results; Episode({this.info, this.results}); Episode.fromJson(Map<String, dynamic> json) { info = json['info'] != null ? new Info.fromJson(json['info']) : null; if (json['results'] != null) { results = <Results>[]; json['results'].forEach((v) { results!.add(new Results.fromJson(v)); }); } } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); if (this.info != null) { data['info'] = this.info!.toJson(); } if (this.results != null) { data['results'] = this.results!.map((v) => v.toJson()).toList(); } return data; } } class Info { int? count; int? pages; String? next; Null prev; Info({this.count, this.pages, this.next, this.prev}); Info.fromJson(Map<String, dynamic> json) { count = json['count']; pages = json['pages']; next = json['next']; prev = json['prev']; } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['count'] = this.count; data['pages'] = this.pages; data['next'] = this.next; data['prev'] = this.prev; return data; } } class Results { int? id; String? name; String? airDate; String? episode; List<String>? characters; String? url; String? created; Results( {this.id, this.name, this.airDate, this.episode, this.characters, this.url, this.created}); Results.fromJson(Map<String, dynamic> json) { id = json['id']; name = json['name']; airDate = json['air_date']; episode = json['episode']; characters = json['characters'].cast<String>(); url = json['url']; created = json['created']; } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['id'] = this.id; data['name'] = this.name; data['air_date'] = this.airDate; data['episode'] = this.episode; data['characters'] = this.characters; data['url'] = this.url; data['created'] = this.created; return data; } }
0
mirrored_repositories/riverpod_tutorial/lib/src/data
mirrored_repositories/riverpod_tutorial/lib/src/data/service/network_service.dart
import 'dart:convert'; import 'package:http/http.dart' as http; import 'package:riverpod_tutorial/src/data/models/location.dart'; import '../../data/models/character.dart'; import '../../utils/constants.dart'; class NetworkService { Future<Character> getCharacters() async { var res = await http.get(Uri.parse(characterUrl)); if (res.statusCode == 200) { // print(res.body); return Character.fromJson(jsonDecode(res.body)); } else { throw (jsonDecode(res.body)); } } Future<Location> getLocation() async { var res = await http.get(Uri.parse(locationUrl)); if (res.statusCode == 200) { print(res.body); return Location.fromJson(jsonDecode(res.body)); } else { throw (jsonDecode(res.body)); } } }
0
mirrored_repositories/riverpod_tutorial/lib/src
mirrored_repositories/riverpod_tutorial/lib/src/viewmodels/home_viewmodel.dart
import 'package:flutter/material.dart'; import 'package:riverpod_tutorial/src/view/screens/character_screen.dart'; import 'package:riverpod_tutorial/src/view/screens/detail_screen.dart'; import 'package:riverpod_tutorial/src/view/screens/location_screen.dart'; import '../data/models/character.dart'; // import 'package:riverpod_tutorial/src/data/models/character.dart'; import '../data/models/location.dart'; import '../utils/util.dart'; import '../data/service/network_service.dart'; class HomeViewModel extends ChangeNotifier { HomeViewModel() { getCharacters(); notifyListeners(); } int selectedMenu = 0; NetworkService service = NetworkService(); Character? characters; Location? locations; APIRequestStatus requestStatus = APIRequestStatus.loading; BottomMenu bottomMenu = BottomMenu.character; List<Widget> pages = <Widget>[ CharacterScreen(), DetailScreen(), LocationScreen(), ]; List<BottomNavigationBarItem> buildThreeItems() { return const <BottomNavigationBarItem>[ BottomNavigationBarItem( icon: Icon(Icons.person), label: 'Character', ), BottomNavigationBarItem( icon: Icon(Icons.book_outlined), label: 'Episode', ), BottomNavigationBarItem( icon: Icon(Icons.location_on_outlined), label: 'Location', ), ]; } changeMenu(index) { selectedMenu = index; notifyListeners(); } getCharacters() async { requestStatus = APIRequestStatus.loading; notifyListeners(); try { Character body = await service.getCharacters(); if (body.results!.length > 0) { characters = body; requestStatus = APIRequestStatus.loaded; notifyListeners(); } else { requestStatus = APIRequestStatus.loading; notifyListeners(); } } catch (e) { if (Util.isConnectionError(e)) { requestStatus = APIRequestStatus.connectionError; notifyListeners(); } else { requestStatus = APIRequestStatus.error; notifyListeners(); } } } getLocation() async { requestStatus = APIRequestStatus.loading; notifyListeners(); try { Location body = await service.getLocation(); if (body.results!.length > 0) { locations = body; requestStatus = APIRequestStatus.loaded; notifyListeners(); } else { requestStatus = APIRequestStatus.loading; notifyListeners(); } } catch (e) { if (Util.isConnectionError(e)) { requestStatus = APIRequestStatus.connectionError; notifyListeners(); } else { requestStatus = APIRequestStatus.error; notifyListeners(); } } } } enum APIRequestStatus { unInitialized, loading, loaded, error, connectionError, } enum BottomMenu { character, location, episode, }
0
mirrored_repositories/riverpod_tutorial/lib/src
mirrored_repositories/riverpod_tutorial/lib/src/utils/themes.dart
import 'package:flutter/material.dart'; class Themes { static Color lightPrimary = Colors.white; static Color darkPrimary = Color(0xff1f1f1f); static Color lightAccent = Color(0xff06d6a7); static Color darkAccent = Color(0xff06d6a7); static Color lightBG = Colors.white; static Color darkBG = Color(0xff121212); static ThemeData lightTheme = ThemeData( // ignore: deprecated_member_use backgroundColor: lightBG, primaryColor: lightPrimary, hintColor: lightAccent, scaffoldBackgroundColor: lightBG, appBarTheme: AppBarTheme( elevation: 0, ), ); static ThemeData darkTheme = ThemeData( brightness: Brightness.dark, // ignore: deprecated_member_use backgroundColor: darkBG, primaryColor: darkPrimary, hintColor: darkAccent, scaffoldBackgroundColor: darkBG, appBarTheme: AppBarTheme( elevation: 0, ), ); static BoxShadow cardShadow = BoxShadow( color: Colors.grey[300]!.withOpacity(0.8), blurRadius: 8.0, spreadRadius: 0.0, offset: Offset( 0.0, 2.0, ), ); }
0
mirrored_repositories/riverpod_tutorial/lib/src
mirrored_repositories/riverpod_tutorial/lib/src/utils/util.dart
class Util { static bool isConnectionError(e) { if (e.toString().contains("SocketException") || e.toString().contains("HandshakeException")) { return true; } else { return false; } } }
0
mirrored_repositories/riverpod_tutorial/lib/src
mirrored_repositories/riverpod_tutorial/lib/src/utils/navigate.dart
import 'package:flutter/material.dart'; class Navigate { static Future pushPage(BuildContext context, Widget page) { var val = Navigator.push( context, MaterialPageRoute( builder: (BuildContext context) { return page; }, ), ); return val; } static Future pushPageDialog(BuildContext context, Widget page) { var val = Navigator.push( context, MaterialPageRoute( builder: (BuildContext context) { return page; }, fullscreenDialog: true, ), ); return val; } static pushPageReplacement(BuildContext context, Widget page) { Navigator.pushReplacement( context, MaterialPageRoute( builder: (BuildContext context) { return page; }, ), ); } }
0
mirrored_repositories/riverpod_tutorial/lib/src
mirrored_repositories/riverpod_tutorial/lib/src/utils/constants.dart
final String appName = 'Riverpod'; final String baseUrl = 'https://rickandmortyapi.com/api'; final String characterUrl = '$baseUrl/character'; final String locationUrl = '$baseUrl/location'; final String episodeUrl = '$baseUrl/episode'; final String detialCharacter = '$characterUrl/';
0
mirrored_repositories/riverpod_tutorial/lib/src
mirrored_repositories/riverpod_tutorial/lib/src/utils/routers.dart
import 'package:flutter/material.dart'; import '../view/screens/detail_screen.dart'; import '../view/screens/home_screen.dart'; import '../view/screens/splash_screen.dart'; class Routers { static Route<dynamic> generateRoute(RouteSettings settings) { switch (settings.name) { case '/': return MaterialPageRoute(builder: (_) => SplashScreen()); case '/home': return MaterialPageRoute(builder: (_) => HomeScreen()); case '/detail': return MaterialPageRoute(builder: (_) => DetailScreen()); default: return MaterialPageRoute( builder: (_) => Scaffold( body: Center(child: Text('No route defined for ${settings.name}')), ), ); } } }
0
mirrored_repositories/riverpod_tutorial/lib/src
mirrored_repositories/riverpod_tutorial/lib/src/utils/providers.dart
import 'package:flutter_riverpod/flutter_riverpod.dart'; import '../viewmodels/home_viewmodel.dart'; final homeProvider = ChangeNotifierProvider((_) => HomeViewModel()); // final seledtedBottomMenu = Provider<int>((ref) => 0);
0
mirrored_repositories/riverpod_tutorial
mirrored_repositories/riverpod_tutorial/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; // import 'package:riverpod_tutorial/main.dart'; import '../example/getAPI/src/app.dart'; // import 'package:riverpod_tutorial/main.dart'; // import 'package:riverpod_tutorial/src/app.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(App()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/riverpod_tutorial/example
mirrored_repositories/riverpod_tutorial/example/ToDo/todo.dart
import 'package:flutter/foundation.dart' show immutable; import 'package:riverpod/riverpod.dart'; import 'package:uuid/uuid.dart'; const _uuid = Uuid(); /// A read-only description of a todo-item @immutable class Todo { const Todo({ required this.description, required this.id, this.completed = false, }); final String id; final String description; final bool completed; @override String toString() { return 'Todo(description: $description, completed: $completed)'; } } /// An object that controls a list of [Todo]. class TodoList extends StateNotifier<List<Todo>> { TodoList([List<Todo>? initialTodos]) : super(initialTodos ?? []); void add(String description) { state = [ ...state, Todo( id: _uuid.v4(), description: description, ), ]; } void toggle(String id) { state = [ for (final todo in state) if (todo.id == id) Todo( id: todo.id, completed: !todo.completed, description: todo.description, ) else todo, ]; } void edit({required String id, required String description}) { state = [ for (final todo in state) if (todo.id == id) Todo( id: todo.id, completed: todo.completed, description: description, ) else todo, ]; } void remove(Todo target) { state = state.where((todo) => todo.id != target.id).toList(); } }
0
mirrored_repositories/riverpod_tutorial/example
mirrored_repositories/riverpod_tutorial/example/ToDo/main.dart
import 'package:flutter/material.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'todo.dart'; /// Some keys used for testing final addTodoKey = UniqueKey(); final activeFilterKey = UniqueKey(); final completedFilterKey = UniqueKey(); final allFilterKey = UniqueKey(); /// Creates a [TodoList] and initialise it with pre-defined values. /// /// We are using [StateNotifierProvider] here as a `List<Todo>` is a complex /// object, with advanced business logic like how to edit a todo. final todoListProvider = StateNotifierProvider<TodoList, List<Todo>>((ref) { // return TodoList(const [ // Todo(id: 'todo-0', description: 'hi'), // Todo(id: 'todo-1', description: 'hello'), // Todo(id: 'todo-2', description: 'bonjour'), // ]); return TodoList(); }); /// The different ways to filter the list of todos enum TodoListFilter { all, active, completed, } /// The currently active filter. /// /// We use [StateProvider] here as there is no fancy logic behind manipulating /// the value since it's just enum. final todoListFilter = StateProvider((_) => TodoListFilter.active); /// The number of uncompleted todos /// /// By using [Provider], this value is cached, making it performant.\ /// Even multiple widgets try to read the number of uncompleted todos, /// the value will be computed only once (until the todo-list changes). /// /// This will also optimise unneeded rebuilds if the todo-list changes, but the /// number of uncompleted todos doesn't (such as when editing a todo). final uncompletedTodosCount = Provider<int>((ref) { return ref.watch(todoListProvider).where((todo) => !todo.completed).length; }); /// The list of todos after applying of [todoListFilter]. /// /// This too uses [Provider], to avoid recomputing the filtered list unless either /// the filter of or the todo-list updates. final filteredTodos = Provider<List<Todo>>((ref) { final filter = ref.watch(todoListFilter); final todos = ref.watch(todoListProvider); switch (filter) { case TodoListFilter.completed: return todos.where((todo) => todo.completed).toList(); case TodoListFilter.active: return todos.where((todo) => !todo.completed).toList(); case TodoListFilter.all: return todos; } }); void main() { runApp(const ProviderScope(child: MyApp())); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return const MaterialApp( home: Home(), ); } } class Home extends HookConsumerWidget { const Home({Key? key}) : super(key: key); @override Widget build(BuildContext context, WidgetRef ref) { final todos = ref.watch(filteredTodos); final newTodoController = useTextEditingController(); return GestureDetector( onTap: () => FocusScope.of(context).unfocus(), child: Scaffold( body: ListView( padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 40), children: [ const Title(), TextField( key: addTodoKey, controller: newTodoController, decoration: const InputDecoration( labelText: 'What needs to be done?', ), onSubmitted: (value) { ref.read(todoListProvider.notifier).add(value); newTodoController.clear(); }, ), const SizedBox(height: 42), const Toolbar(), if (todos.isNotEmpty) const Divider(height: 0), for (var i = 0; i < todos.length; i++) ...[ if (i > 0) const Divider(height: 0), Dismissible( key: ValueKey(todos[i].id), onDismissed: (_) { ref.read(todoListProvider.notifier).remove(todos[i]); }, child: ProviderScope( overrides: [ _currentTodo.overrideWithValue(todos[i]), ], child: const TodoItem(), ), ), ], ], ), ), ); } } class Toolbar extends HookConsumerWidget { const Toolbar({ Key? key, }) : super(key: key); @override Widget build(BuildContext context, WidgetRef ref) { final filter = ref.watch(todoListFilter); Color? textColorFor(TodoListFilter value) { return filter == value ? Colors.blue : Colors.black; } return Material( child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Expanded( child: Text( '${ref.watch(uncompletedTodosCount)} items left', overflow: TextOverflow.ellipsis, ), ), Tooltip( key: allFilterKey, message: 'All todos', child: TextButton( onPressed: () => ref.read(todoListFilter.notifier).state = TodoListFilter.all, style: ButtonStyle( visualDensity: VisualDensity.compact, foregroundColor: MaterialStateProperty.all(textColorFor(TodoListFilter.all)), ), child: const Text('All'), ), ), Tooltip( key: activeFilterKey, message: 'Only uncompleted todos', child: TextButton( onPressed: () => ref.read(todoListFilter.notifier).state = TodoListFilter.active, style: ButtonStyle( visualDensity: VisualDensity.compact, foregroundColor: MaterialStateProperty.all( textColorFor(TodoListFilter.active), ), ), child: const Text('Active'), ), ), Tooltip( key: completedFilterKey, message: 'Only completed todos', child: TextButton( onPressed: () => ref.read(todoListFilter.notifier).state = TodoListFilter.completed, style: ButtonStyle( visualDensity: VisualDensity.compact, foregroundColor: MaterialStateProperty.all( textColorFor(TodoListFilter.completed), ), ), child: const Text('Completed'), ), ), ], ), ); } } class Title extends StatelessWidget { const Title({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return const Text( 'todos', textAlign: TextAlign.center, style: TextStyle( color: Color.fromARGB(38, 47, 47, 247), fontSize: 100, fontWeight: FontWeight.w100, fontFamily: 'Helvetica Neue', ), ); } } /// A provider which exposes the [Todo] displayed by a [TodoItem]. /// /// By retrieving the [Todo] through a provider instead of through its /// constructor, this allows [TodoItem] to be instantiated using the `const` keyword. /// /// This ensures that when we add/remove/edit todos, only what the /// impacted widgets rebuilds, instead of the entire list of items. final _currentTodo = Provider<Todo>((ref) => throw UnimplementedError()); class TodoItem extends HookConsumerWidget { const TodoItem({Key? key}) : super(key: key); @override Widget build(BuildContext context, WidgetRef ref) { final todo = ref.watch(_currentTodo); final itemFocusNode = useFocusNode(); final itemIsFocused = useIsFocused(itemFocusNode); final textEditingController = useTextEditingController(); final textFieldFocusNode = useFocusNode(); return Material( color: Colors.white, elevation: 6, child: Focus( focusNode: itemFocusNode, onFocusChange: (focused) { if (focused) { textEditingController.text = todo.description; } else { // Commit changes only when the textfield is unfocused, for performance ref .read(todoListProvider.notifier) .edit(id: todo.id, description: textEditingController.text); } }, child: ListTile( onTap: () { itemFocusNode.requestFocus(); textFieldFocusNode.requestFocus(); }, leading: Checkbox( value: todo.completed, onChanged: (value) => ref.read(todoListProvider.notifier).toggle(todo.id), ), title: itemIsFocused ? TextField( autofocus: true, focusNode: textFieldFocusNode, controller: textEditingController, ) : Text(todo.description), ), ), ); } } bool useIsFocused(FocusNode node) { final isFocused = useState(node.hasFocus); useEffect( () { void listener() { isFocused.value = node.hasFocus; } node.addListener(listener); return () => node.removeListener(listener); }, [node], ); return isFocused.value; }
0
mirrored_repositories/riverpod_tutorial/example
mirrored_repositories/riverpod_tutorial/example/calculator/main.dart
import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'calculator_provider.dart'; void main() { runApp(ProviderScope(child: MyApp())); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Riverpod Example: Calculator', theme: ThemeData( primarySwatch: Colors.blue, ), home: CalculatorScreen(), ); } } class CalculatorScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final calculator = ref.watch(calculatorProvider).result; final num1Controller = ref.read(num1Provider); final num2Controller = ref.read(num2Provider); return Scaffold( appBar: AppBar( title: Text('Calculator'), ), body: Center( child: Column( children: [ Container( margin: EdgeInsets.all(30), child: TextField( controller: num1Controller, keyboardType: TextInputType.number, decoration: InputDecoration( border: OutlineInputBorder(), labelText: 'Angka Pertama', hintText: 'Angka Pertama', ), ), ), Container( margin: EdgeInsets.symmetric(horizontal: 30), child: TextField( controller: num2Controller, keyboardType: TextInputType.number, decoration: InputDecoration( border: OutlineInputBorder(), labelText: 'Angka Kedua', hintText: 'Angka Kedua', ), ), ), Container( margin: EdgeInsets.symmetric(horizontal: 30), child: CalculatorButtons(), ), SizedBox( height: 20, ), Container( margin: EdgeInsets.symmetric(horizontal: 30), child: Text( 'Hasil: $calculator', style: TextStyle(fontSize: 24), ), ), ], ), ), ); } } class CalculatorButtons extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final calculator = ref.read(calculatorProvider); final num1Value = ref.read(num1Provider).text; final num2Value = ref.read(num2Provider).text; return Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.center, children: [ CalculatorButton( text: '+', onPressed: () { calculator.add( double.parse(num1Value), double.parse(num2Value)); }, ), SizedBox(width: 20), CalculatorButton( text: '-', onPressed: () { calculator.min( double.parse(num1Value), double.parse(num2Value)); }, ), SizedBox( width: 20, ), CalculatorButton( text: '√', onPressed: () { calculator.akar( double.parse(num1Value), double.parse(num2Value)); }, ), ], ), SizedBox(height: 20), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ CalculatorButton( text: '*', onPressed: () { calculator.kali( double.parse(num1Value), double.parse(num2Value)); }, ), SizedBox(width: 20), CalculatorButton( text: '/', onPressed: () { calculator.bagi( double.parse(num1Value), double.parse(num2Value)); }, ), SizedBox(width: 20), CalculatorButton( text: '^', onPressed: () { calculator.kuadrat( double.parse(num1Value), double.parse(num2Value)); }, ), ], ), ], ); } } class CalculatorButton extends StatelessWidget { final String text; final VoidCallback onPressed; const CalculatorButton({ required this.text, required this.onPressed, }); @override Widget build(BuildContext context) { return ElevatedButton( onPressed: onPressed, child: Text(text), ); } }
0
mirrored_repositories/riverpod_tutorial/example
mirrored_repositories/riverpod_tutorial/example/calculator/calculator_provider.dart
import 'dart:math'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; final calculatorProvider = ChangeNotifierProvider<Calculator>((ref) => Calculator()); final num1Provider = Provider<TextEditingController>((ref) => TextEditingController()); final num2Provider = Provider<TextEditingController>((ref) => TextEditingController()); class Calculator extends ChangeNotifier { double _result = 0; double get result => _result; void zero() { _result = 0.0; notifyListeners(); } void add(double a, double b) { _result = a + b; notifyListeners(); } void min(double a, double b) { _result = a - b; notifyListeners(); } void kali(double a, double b) { _result = a * b; notifyListeners(); } void bagi(double a, double b) { _result = a / b; notifyListeners(); } void kuadrat(double a, double exponent) { _result = pow(a, exponent) as double; notifyListeners(); } void akar(double a, double exponent) { _result = pow(a, 1 / exponent) as double; notifyListeners(); } }
0
mirrored_repositories/riverpod_tutorial/example
mirrored_repositories/riverpod_tutorial/example/getAPI/main.dart
import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'src/app.dart'; void main() { runApp(ProviderScope(child: App())); }
0
mirrored_repositories/riverpod_tutorial/example/getAPI
mirrored_repositories/riverpod_tutorial/example/getAPI/src/app.dart
import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'utils/themes.dart'; import 'utils/routers.dart'; class App extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( title: 'Riverpod', theme: themeData(Themes.lightTheme), onGenerateRoute: Routers.generateRoute, initialRoute: '/', ); } ThemeData themeData(ThemeData theme) { return theme.copyWith( textTheme: GoogleFonts.sourceSansProTextTheme( theme.textTheme, ), ); } }
0
mirrored_repositories/riverpod_tutorial/example/getAPI/src/view
mirrored_repositories/riverpod_tutorial/example/getAPI/src/view/widgets/custom_card.dart
import 'package:flutter/material.dart'; import '../../utils/themes.dart'; class CustomCard extends StatelessWidget { final Widget child; final VoidCallback onTap; final BorderRadius borderRadius; final bool elevated; CustomCard({ required this.child, required this.onTap, required this.borderRadius, this.elevated = true, }); @override Widget build(BuildContext context) { return Container( decoration: elevated ? BoxDecoration( borderRadius: borderRadius, color: Theme.of(context).cardColor, boxShadow: [ Themes.cardShadow, ], ) : BoxDecoration( borderRadius: borderRadius, color: Theme.of(context).cardColor, ), child: Material( type: MaterialType.transparency, borderRadius: borderRadius, child: InkWell( borderRadius: borderRadius, onTap: onTap, child: child, ), ), ); } }
0
mirrored_repositories/riverpod_tutorial/example/getAPI/src/view
mirrored_repositories/riverpod_tutorial/example/getAPI/src/view/widgets/body_builder.dart
import 'package:flutter/material.dart'; import '../../viewmodels/home_viewmodel.dart'; import 'errors/error_widget.dart'; class BodyBuilder extends StatelessWidget { final APIRequestStatus apiRequestStatus; final Widget child; final Widget loadingWidget; final VoidCallback reload; BodyBuilder( {Key? key, required this.apiRequestStatus, required this.child, required this.loadingWidget, required this.reload}) : super(key: key); @override Widget build(BuildContext context) { return _buildBody(); } Widget _buildBody() { switch (apiRequestStatus) { case APIRequestStatus.loading: return loadingWidget; case APIRequestStatus.unInitialized: return loadingWidget; case APIRequestStatus.connectionError: return MyErrorWidget(refreshCallBack: reload, isConnection: true); case APIRequestStatus.error: return MyErrorWidget(refreshCallBack: reload); case APIRequestStatus.loaded: return child; default: return loadingWidget; } } }
0
mirrored_repositories/riverpod_tutorial/example/getAPI/src/view
mirrored_repositories/riverpod_tutorial/example/getAPI/src/view/widgets/character_card.dart
import 'package:flutter/material.dart'; import '../../data/models/character.dart'; import 'custom_card.dart'; class CharacterCard extends StatelessWidget { final Character? character; CharacterCard({required this.character}); @override Widget build(BuildContext context) { final double width = MediaQuery.of(context).size.width; final double height = MediaQuery.of(context).size.height; return CustomCard( onTap: () {}, borderRadius: BorderRadius.all(Radius.circular(10.0)), child: Container( width: width, height: height * 0.82, child: ListView.builder( itemCount: character!.results!.length, itemBuilder: (context, index) { return Container( margin: EdgeInsets.only(bottom: 5), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ ClipRRect( borderRadius: BorderRadius.only( topLeft: Radius.circular(10.0), bottomLeft: Radius.circular(10.0), ), child: Image.network( character!.results![index].image!, height: 145.0, ), ), SizedBox( width: 10.0, ), Padding( padding: const EdgeInsets.symmetric(vertical: 10.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( character!.results![index].name!, style: TextStyle( fontWeight: FontWeight.bold, fontSize: 18.0, ), ), Row( children: [ Container( height: 7.0, width: 7.0, decoration: BoxDecoration( color: statusColor( character!.results![index].status!), shape: BoxShape.circle, ), ), SizedBox(width: 5.0), Text( '${character!.results![index].status!} - ${character!.results![index].species!}', style: TextStyle( fontWeight: FontWeight.w500, fontSize: 14.0, ), ), ], ), SizedBox(height: 5.0), buildInfo('Last known location:', character!.results![index].origin!.name), SizedBox(height: 5.0), buildInfo('Origin:', character!.results![index].location!.name), ], ), ), ], ), ); }, ), ), // child: Text("data"), ); } // buildImage(image) { // return ClipRRect( // borderRadius: BorderRadius.only( // topLeft: Radius.circular(10.0), // bottomLeft: Radius.circular(10.0), // ), // child: Image.network( // image, // height: 145.0, // ), // ); // } buildInfo(title, content) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( title, style: TextStyle( fontWeight: FontWeight.w500, fontSize: 14.0, color: Colors.grey, ), ), Text( content, style: TextStyle( fontWeight: FontWeight.w500, fontSize: 14.0, ), ), ], ); } Color? statusColor(status) { switch (status.toLowerCase()) { case 'alive': return Colors.green[300]; case 'dead': return Colors.red; case 'unknown': return Colors.blueGrey; default: return Colors.blueGrey; } } }
0
mirrored_repositories/riverpod_tutorial/example/getAPI/src/view/widgets
mirrored_repositories/riverpod_tutorial/example/getAPI/src/view/widgets/errors/error_widget.dart
import 'package:flutter/material.dart'; class MyErrorWidget extends StatelessWidget { final VoidCallback refreshCallBack; final bool isConnection; MyErrorWidget({required this.refreshCallBack, this.isConnection = false}); @override Widget build(BuildContext context) { return Container( alignment: Alignment.center, margin: EdgeInsets.symmetric(horizontal: 20.0), child: Column( mainAxisSize: MainAxisSize.min, children: <Widget>[ Text( '😔', style: TextStyle( fontSize: 20.0, ), ), Container( margin: EdgeInsets.symmetric(vertical: 14.0), child: Text( '${getErrorText(context)}', textAlign: TextAlign.center, style: TextStyle( color: Theme.of(context).textTheme.titleLarge!.color, fontSize: 17.0, fontWeight: FontWeight.w600, ), ), ), Container( child: ElevatedButton( onPressed: refreshCallBack, style: ElevatedButton.styleFrom( backgroundColor: Theme.of(context).colorScheme.primary, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(5.0), ), ), child: Text( 'Try again', style: TextStyle( color: Colors.white, fontSize: 15.0, fontWeight: FontWeight.bold, ), ), ), ) ], ), ); } getErrorText(BuildContext context) { if (isConnection) { return 'Connection problems'; } else { return 'An error occurred'; } } }
0
mirrored_repositories/riverpod_tutorial/example/getAPI/src/view
mirrored_repositories/riverpod_tutorial/example/getAPI/src/view/screens/home_screen.dart
import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import '../../utils/constants.dart'; import '../../utils/providers.dart'; class HomeScreen extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { var viewModel = ref.watch(homeProvider); return Scaffold( appBar: AppBar( title: Text("$appName"), ), bottomNavigationBar: BottomNavigationBar( currentIndex: viewModel.selectedMenu, onTap: (index) { viewModel.changeMenu(index); }, items: viewModel.buildThreeItems(), ), body: viewModel.pages[viewModel.selectedMenu], // body: BodyBuilder( // apiRequestStatus: viewModel.requestStatus, // loadingWidget: Center(child: CircularProgressIndicator()), // reload: () => viewModel.getCharacters(), // child: ListView.builder( // physics: ClampingScrollPhysics(), // itemCount: 1, // itemBuilder: (BuildContext context, int index) { // if (viewModel.characters?.results?.isNotEmpty == true) { // Character? character = viewModel // .characters; //hilangkan "as Character?" jika tidak bisa // return Padding( // padding: const EdgeInsets.symmetric( // vertical: 5.0, // horizontal: 10.0, // ), // child: CharacterCard(character: character), // ); // } else { // return Center(child: CircularProgressIndicator()); // } // }, // ), // ), ); } }
0
mirrored_repositories/riverpod_tutorial/example/getAPI/src/view
mirrored_repositories/riverpod_tutorial/example/getAPI/src/view/screens/character_screen.dart
import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import '../../data/models/character.dart'; import '../../utils/providers.dart'; import '../widgets/body_builder.dart'; import '../widgets/character_card.dart'; class CharacterScreen extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { var viewModel = ref.watch(homeProvider); return BodyBuilder( apiRequestStatus: viewModel.requestStatus, loadingWidget: Center(child: CircularProgressIndicator()), reload: () => viewModel.getCharacters(), child: ListView.builder( physics: ClampingScrollPhysics(), itemCount: 1, itemBuilder: (BuildContext context, int index) { if (viewModel.characters?.results?.isNotEmpty == true) { Character? character = viewModel .characters; //hilangkan "as Character?" jika tidak bisa return Padding( padding: const EdgeInsets.symmetric( vertical: 5.0, horizontal: 10.0, ), child: CharacterCard(character: character), ); } else { return Center(child: CircularProgressIndicator()); } }, ), ); } }
0
mirrored_repositories/riverpod_tutorial/example/getAPI/src/view
mirrored_repositories/riverpod_tutorial/example/getAPI/src/view/screens/location_screen.dart
import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; class LocationScreen extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { return Container( child: Text("screen location"), ); } }
0
mirrored_repositories/riverpod_tutorial/example/getAPI/src/view
mirrored_repositories/riverpod_tutorial/example/getAPI/src/view/screens/splash_screen.dart
import 'dart:async'; import 'package:flutter/material.dart'; import 'home_screen.dart'; import '../../utils/navigate.dart'; class SplashScreen extends StatefulWidget { @override _SplashScreenState createState() => _SplashScreenState(); } class _SplashScreenState extends State<SplashScreen> { startTimeout() { return new Timer(Duration(seconds: 2), handleTimeout); } void handleTimeout() { changeScreen(); } changeScreen() async { Navigate.pushPageReplacement(context, HomeScreen()); } @override void initState() { super.initState(); startTimeout(); } @override Widget build(BuildContext context) { return Scaffold( body: Center( child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ // Image.asset( // "assets/images/black_icon.png", // color: Theme.of(context).textTheme.titleLarge!.color, // height: 150, // width: 150, // ), Text("RIVERPOD API TUTORIAL") ], ), ), ); } }
0
mirrored_repositories/riverpod_tutorial/example/getAPI/src/view
mirrored_repositories/riverpod_tutorial/example/getAPI/src/view/screens/detail_screen.dart
import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; class DetailScreen extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { return Scaffold( body: Container( child: Text("screen2"), ), ); } }
0
mirrored_repositories/riverpod_tutorial/example/getAPI/src/data
mirrored_repositories/riverpod_tutorial/example/getAPI/src/data/models/location.dart
class Location { Info? info; List<Results>? results; Location({this.info, this.results}); Location.fromJson(Map<String, dynamic> json) { info = json['info'] != null ? new Info.fromJson(json['info']) : null; if (json['results'] != null) { results = <Results>[]; json['results'].forEach((v) { results!.add(new Results.fromJson(v)); }); } } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); if (this.info != null) { data['info'] = this.info!.toJson(); } if (this.results != null) { data['results'] = this.results!.map((v) => v.toJson()).toList(); } return data; } } class Info { int? count; int? pages; String? next; Null prev; Info({this.count, this.pages, this.next, this.prev}); Info.fromJson(Map<String, dynamic> json) { count = json['count']; pages = json['pages']; next = json['next']; prev = json['prev']; } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['count'] = this.count; data['pages'] = this.pages; data['next'] = this.next; data['prev'] = this.prev; return data; } } class Results { int? id; String? name; String? type; String? dimension; List<String>? residents; String? url; String? created; Results( {this.id, this.name, this.type, this.dimension, this.residents, this.url, this.created}); Results.fromJson(Map<String, dynamic> json) { id = json['id']; name = json['name']; type = json['type']; dimension = json['dimension']; residents = json['residents'].cast<String>(); url = json['url']; created = json['created']; } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['id'] = this.id; data['name'] = this.name; data['type'] = this.type; data['dimension'] = this.dimension; data['residents'] = this.residents; data['url'] = this.url; data['created'] = this.created; return data; } }
0
mirrored_repositories/riverpod_tutorial/example/getAPI/src/data
mirrored_repositories/riverpod_tutorial/example/getAPI/src/data/models/character.dart
class Character { Info? info; List<Results>? results; Character({this.info, this.results}); Character.fromJson(Map<String, dynamic> json) { info = json['info'] != null ? new Info.fromJson(json['info']) : null; if (json['results'] != null) { results = <Results>[]; json['results'].forEach((v) { results!.add(new Results.fromJson(v)); }); } } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); if (this.info != null) { data['info'] = this.info!.toJson(); } if (this.results != null) { data['results'] = this.results!.map((v) => v.toJson()).toList(); } return data; } } class Info { int? count; int? pages; String? next; Null prev; Info({this.count, this.pages, this.next, this.prev}); Info.fromJson(Map<String, dynamic> json) { count = json['count']; pages = json['pages']; next = json['next']; prev = json['prev']; } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['count'] = this.count; data['pages'] = this.pages; data['next'] = this.next; data['prev'] = this.prev; return data; } } class Results { int? id; String? name; String? status; String? species; String? type; String? gender; Origin? origin; Origin? location; String? image; List<String>? episode; String? url; String? created; Results( {this.id, this.name, this.status, this.species, this.type, this.gender, this.origin, this.location, this.image, this.episode, this.url, this.created}); Results.fromJson(Map<String, dynamic> json) { id = json['id']; name = json['name']; status = json['status']; species = json['species']; type = json['type']; gender = json['gender']; origin = json['origin'] != null ? new Origin.fromJson(json['origin']) : null; location = json['location'] != null ? new Origin.fromJson(json['location']) : null; image = json['image']; episode = json['episode'].cast<String>(); url = json['url']; created = json['created']; } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['id'] = this.id; data['name'] = this.name; data['status'] = this.status; data['species'] = this.species; data['type'] = this.type; data['gender'] = this.gender; if (this.origin != null) { data['origin'] = this.origin!.toJson(); } if (this.location != null) { data['location'] = this.location!.toJson(); } data['image'] = this.image; data['episode'] = this.episode; data['url'] = this.url; data['created'] = this.created; return data; } } class Origin { String? name; String? url; Origin({this.name, this.url}); Origin.fromJson(Map<String, dynamic> json) { name = json['name']; url = json['url']; } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['name'] = this.name; data['url'] = this.url; return data; } }
0
mirrored_repositories/riverpod_tutorial/example/getAPI/src/data
mirrored_repositories/riverpod_tutorial/example/getAPI/src/data/models/episode.dart
class Episode { Info? info; List<Results>? results; Episode({this.info, this.results}); Episode.fromJson(Map<String, dynamic> json) { info = json['info'] != null ? new Info.fromJson(json['info']) : null; if (json['results'] != null) { results = <Results>[]; json['results'].forEach((v) { results!.add(new Results.fromJson(v)); }); } } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); if (this.info != null) { data['info'] = this.info!.toJson(); } if (this.results != null) { data['results'] = this.results!.map((v) => v.toJson()).toList(); } return data; } } class Info { int? count; int? pages; String? next; Null prev; Info({this.count, this.pages, this.next, this.prev}); Info.fromJson(Map<String, dynamic> json) { count = json['count']; pages = json['pages']; next = json['next']; prev = json['prev']; } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['count'] = this.count; data['pages'] = this.pages; data['next'] = this.next; data['prev'] = this.prev; return data; } } class Results { int? id; String? name; String? airDate; String? episode; List<String>? characters; String? url; String? created; Results( {this.id, this.name, this.airDate, this.episode, this.characters, this.url, this.created}); Results.fromJson(Map<String, dynamic> json) { id = json['id']; name = json['name']; airDate = json['air_date']; episode = json['episode']; characters = json['characters'].cast<String>(); url = json['url']; created = json['created']; } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['id'] = this.id; data['name'] = this.name; data['air_date'] = this.airDate; data['episode'] = this.episode; data['characters'] = this.characters; data['url'] = this.url; data['created'] = this.created; return data; } }
0
mirrored_repositories/riverpod_tutorial/example/getAPI/src/data
mirrored_repositories/riverpod_tutorial/example/getAPI/src/data/service/network_service.dart
import 'dart:convert'; import 'package:http/http.dart' as http; import '../../data/models/character.dart'; import '../../utils/constants.dart'; class NetworkService { Future<Character> getCharacters() async { var res = await http.get(Uri.parse(characterUrl)); if (res.statusCode == 200) { // print(res.body); return Character.fromJson(jsonDecode(res.body)); } else { throw (jsonDecode(res.body)); } } }
0
mirrored_repositories/riverpod_tutorial/example/getAPI/src
mirrored_repositories/riverpod_tutorial/example/getAPI/src/viewmodels/home_viewmodel.dart
import 'package:flutter/material.dart'; import 'package:riverpod_tutorial/src/view/screens/character_screen.dart'; import 'package:riverpod_tutorial/src/view/screens/detail_screen.dart'; import 'package:riverpod_tutorial/src/view/screens/location_screen.dart'; import '../data/models/character.dart'; // import 'package:riverpod_tutorial/src/data/models/character.dart'; import '../utils/util.dart'; import '../data/service/network_service.dart'; class HomeViewModel extends ChangeNotifier { HomeViewModel() { getCharacters(); notifyListeners(); } int selectedMenu = 0; NetworkService service = NetworkService(); Character? characters; APIRequestStatus requestStatus = APIRequestStatus.loading; BottomMenu bottomMenu = BottomMenu.character; List<Widget> pages = <Widget>[ CharacterScreen(), DetailScreen(), LocationScreen(), ]; List<BottomNavigationBarItem> buildThreeItems() { return const <BottomNavigationBarItem>[ BottomNavigationBarItem( icon: Icon(Icons.person), label: 'Character', ), BottomNavigationBarItem( icon: Icon(Icons.location_on_outlined), label: 'Location', ), BottomNavigationBarItem( icon: Icon(Icons.book_outlined), label: 'Episode', ), ]; } changeMenu(index) { selectedMenu = index; notifyListeners(); } getCharacters() async { requestStatus = APIRequestStatus.loading; notifyListeners(); try { Character body = await service.getCharacters(); if (body.results!.length > 0) { characters = body; requestStatus = APIRequestStatus.loaded; notifyListeners(); } else { requestStatus = APIRequestStatus.loading; notifyListeners(); } } catch (e) { if (Util.isConnectionError(e)) { requestStatus = APIRequestStatus.connectionError; notifyListeners(); } else { requestStatus = APIRequestStatus.error; notifyListeners(); } } } } enum APIRequestStatus { unInitialized, loading, loaded, error, connectionError, } enum BottomMenu { character, location, episode, }
0
mirrored_repositories/riverpod_tutorial/example/getAPI/src
mirrored_repositories/riverpod_tutorial/example/getAPI/src/utils/themes.dart
import 'package:flutter/material.dart'; class Themes { static Color lightPrimary = Colors.white; static Color darkPrimary = Color(0xff1f1f1f); static Color lightAccent = Color(0xff06d6a7); static Color darkAccent = Color(0xff06d6a7); static Color lightBG = Colors.white; static Color darkBG = Color(0xff121212); static ThemeData lightTheme = ThemeData( // ignore: deprecated_member_use backgroundColor: lightBG, primaryColor: lightPrimary, hintColor: lightAccent, scaffoldBackgroundColor: lightBG, appBarTheme: AppBarTheme( elevation: 0, ), ); static ThemeData darkTheme = ThemeData( brightness: Brightness.dark, // ignore: deprecated_member_use backgroundColor: darkBG, primaryColor: darkPrimary, hintColor: darkAccent, scaffoldBackgroundColor: darkBG, appBarTheme: AppBarTheme( elevation: 0, ), ); static BoxShadow cardShadow = BoxShadow( color: Colors.grey[300]!.withOpacity(0.8), blurRadius: 8.0, spreadRadius: 0.0, offset: Offset( 0.0, 2.0, ), ); }
0
mirrored_repositories/riverpod_tutorial/example/getAPI/src
mirrored_repositories/riverpod_tutorial/example/getAPI/src/utils/util.dart
class Util { static bool isConnectionError(e) { if (e.toString().contains("SocketException") || e.toString().contains("HandshakeException")) { return true; } else { return false; } } }
0
mirrored_repositories/riverpod_tutorial/example/getAPI/src
mirrored_repositories/riverpod_tutorial/example/getAPI/src/utils/navigate.dart
import 'package:flutter/material.dart'; class Navigate { static Future pushPage(BuildContext context, Widget page) { var val = Navigator.push( context, MaterialPageRoute( builder: (BuildContext context) { return page; }, ), ); return val; } static Future pushPageDialog(BuildContext context, Widget page) { var val = Navigator.push( context, MaterialPageRoute( builder: (BuildContext context) { return page; }, fullscreenDialog: true, ), ); return val; } static pushPageReplacement(BuildContext context, Widget page) { Navigator.pushReplacement( context, MaterialPageRoute( builder: (BuildContext context) { return page; }, ), ); } }
0
mirrored_repositories/riverpod_tutorial/example/getAPI/src
mirrored_repositories/riverpod_tutorial/example/getAPI/src/utils/constants.dart
final String appName = 'Riverpod'; final String baseUrl = 'https://rickandmortyapi.com/api'; final String characterUrl = '$baseUrl/character'; final String locationUrl = '$baseUrl/location'; final String episodeUrl = '$baseUrl/episode'; final String detialCharacter = '$characterUrl/';
0
mirrored_repositories/riverpod_tutorial/example/getAPI/src
mirrored_repositories/riverpod_tutorial/example/getAPI/src/utils/routers.dart
import 'package:flutter/material.dart'; import '../view/screens/detail_screen.dart'; import '../view/screens/home_screen.dart'; import '../view/screens/splash_screen.dart'; class Routers { static Route<dynamic> generateRoute(RouteSettings settings) { switch (settings.name) { case '/': return MaterialPageRoute(builder: (_) => SplashScreen()); case '/home': return MaterialPageRoute(builder: (_) => HomeScreen()); case '/detail': return MaterialPageRoute(builder: (_) => DetailScreen()); default: return MaterialPageRoute( builder: (_) => Scaffold( body: Center(child: Text('No route defined for ${settings.name}')), ), ); } } }
0
mirrored_repositories/riverpod_tutorial/example/getAPI/src
mirrored_repositories/riverpod_tutorial/example/getAPI/src/utils/providers.dart
import 'package:flutter_riverpod/flutter_riverpod.dart'; import '../viewmodels/home_viewmodel.dart'; final homeProvider = ChangeNotifierProvider((_) => HomeViewModel()); // final seledtedBottomMenu = Provider<int>((ref) => 0);
0
mirrored_repositories/riverpod_tutorial/example
mirrored_repositories/riverpod_tutorial/example/bmi_calculator/bmi_provider.dart
import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; final bmicalculatorProvider = ChangeNotifierProvider<Bmi>((ref) => Bmi()); final tinggiProvider = Provider<TextEditingController>((ref) => TextEditingController()); final beratProvider = Provider<TextEditingController>((ref) => TextEditingController()); class Bmi extends ChangeNotifier { double _result = 0; String get result => _result.toStringAsFixed(1); void bmi(double tinggi, double berat) { double tinggiMeter = tinggi / 100; // Convert tinggi from cm to meter _result = berat / (tinggiMeter * tinggiMeter); notifyListeners(); } }
0
mirrored_repositories/riverpod_tutorial/example
mirrored_repositories/riverpod_tutorial/example/bmi_calculator/main.dart
import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'bmi_provider.dart'; void main() { runApp(ProviderScope(child: MyApp())); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Riverpod Example: BMI CALCULATOR', theme: ThemeData( primarySwatch: Colors.blue, ), home: BmiCalculatorScreen(), ); } } class BmiCalculatorScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final result = ref.watch(bmicalculatorProvider).result; final provider = ref.watch(bmicalculatorProvider); final tinggiController = ref.read(tinggiProvider); final beratController = ref.read(beratProvider); return Scaffold( appBar: AppBar( title: Text('Calculator BMI'), ), body: Center( child: Column( children: [ Container( margin: EdgeInsets.all(30), child: TextField( controller: tinggiController, keyboardType: TextInputType.number, decoration: InputDecoration( border: OutlineInputBorder(), labelText: 'Tinggi badan', hintText: 'Masukkan dalam satuan cm', ), ), ), Container( margin: EdgeInsets.symmetric(horizontal: 30), child: TextField( controller: beratController, keyboardType: TextInputType.number, decoration: InputDecoration( border: OutlineInputBorder(), labelText: 'Berat badan', hintText: 'Masukkan dalam satuan kg', ), ), ), Container( margin: EdgeInsets.symmetric(horizontal: 30), child: CalculatorButton( text: 'Hitung >>', onPressed: () { provider.bmi(double.parse(tinggiController.text), double.parse(beratController.text)); }, ), ), SizedBox( height: 20, ), Container( margin: EdgeInsets.symmetric(horizontal: 30), child: Text( 'Hasil: $result', style: TextStyle(fontSize: 24), ), ), SizedBox( height: 20, ), if (double.parse(result) != 0) if (double.parse(result) < 18.5) Container( margin: EdgeInsets.symmetric(horizontal: 30), child: Text( 'Berat badan kurang', textAlign: TextAlign.center, style: TextStyle(fontSize: 24), ), ), if (double.parse(result) >= 18.5 && double.parse(result) < 23) Container( margin: EdgeInsets.symmetric(horizontal: 30), child: Text( 'Berat badan normal', textAlign: TextAlign.center, style: TextStyle(fontSize: 24), ), ), if (double.parse(result) >= 23 && double.parse(result) < 30) Container( margin: EdgeInsets.symmetric(horizontal: 30), child: Text( 'Berat badan berlebih (kecenderungan obesitas)', textAlign: TextAlign.center, style: TextStyle(fontSize: 24), ), ), if (double.parse(result) >= 30) Container( margin: EdgeInsets.symmetric(horizontal: 30), child: Text( 'Obesitas', textAlign: TextAlign.center, style: TextStyle(fontSize: 24), ), ), ], ), ), ); } } class CalculatorButton extends StatelessWidget { final String text; final VoidCallback onPressed; const CalculatorButton({ required this.text, required this.onPressed, }); @override Widget build(BuildContext context) { return ElevatedButton( onPressed: onPressed, child: Text(text), ); } }
0
mirrored_repositories/coderiver-flutter
mirrored_repositories/coderiver-flutter/lib/main.dart
import 'package:coderiver/ui/Application.dart'; import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: Scaffold( appBar: AppBar( title: Text("CodeRiver"), ), body: ApplicationPage(), ) ); } }
0
mirrored_repositories/coderiver-flutter/lib
mirrored_repositories/coderiver-flutter/lib/api/CommonService.dart
import 'dart:async'; import 'package:coderiver/common/User.dart'; import 'package:dio/dio.dart'; import 'Api.dart'; class CommonService { Future<Response> getWeChatListData(String url) async { return await Dio().get(url, options: _getOptions()); } Future<Response> getTreeItemList(String url) async { return await Dio().get(url, options: _getOptions()); } Future<Response> getArticleListData(int page) async { return await Dio() .get("${Api.HOME_LIST}$page/json", options: _getOptions()); } Future<Response> getProjectListData(String url) async { return await Dio().get(url, options: _getOptions()); } Future<Response> login(String username, String password) async { FormData formData = new FormData.from({ "username": "$username", "password": "$password", }); return await Dio().post(Api.HOME_LOGIN, data: formData); } Future<Response> register(String username, String password) async { FormData formData = new FormData.from({ "username": "$username", "password": "$password", }); return await Dio().post(Api.REGISTER, data: formData); } Options _getOptions() { return Options(headers: User().getHeader()); } }
0
mirrored_repositories/coderiver-flutter/lib
mirrored_repositories/coderiver-flutter/lib/api/Api.dart
class Api { static final String HOME_BANNER = "http://www."; static final String HOME_LIST = "http://www."; static final String HOME_LOGIN = "http://www."; static final String REGISTER = "http://www."; }
0
mirrored_repositories/coderiver-flutter/lib
mirrored_repositories/coderiver-flutter/lib/common/Router.dart
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class Router { /*openWeb(BuildContext context, String url, String title) { Navigator.of(context) .push(MaterialPageRoute(builder: (BuildContext context) { return WebViewPage(url: url, title: title); })); }*/ back(BuildContext context) { Navigator.of(context).pop(); } Widget _transitionsBuilder(BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, Widget child) { return FadeTransition( opacity: animation, child: FadeTransition( opacity: Tween<double>(begin: 0.5, end: 1.0).animate(animation), child: child, ), ); } }
0
mirrored_repositories/coderiver-flutter/lib
mirrored_repositories/coderiver-flutter/lib/common/Snack.dart
import 'package:flutter/material.dart'; class Snack { static void show(BuildContext context, String str) { Scaffold.of(context).showSnackBar(SnackBar( content: Text(null == str ? "" : str), )); } }
0
mirrored_repositories/coderiver-flutter/lib
mirrored_repositories/coderiver-flutter/lib/common/User.dart
import 'dart:async'; import 'dart:convert'; import 'package:coderiver/api/CommonService.dart'; import 'package:coderiver/utils/DateUtil.dart'; import 'package:dio/dio.dart'; import 'package:coderiver/common/Sp.dart'; class User { String userName; String password; String cookie; DateTime cookieExpiresTime; Map<String, String> _headerMap; static final User _singleton = User._internal(); factory User() { return _singleton; } User._internal(); bool isLogin() { return null != userName && userName.length >= 6 && null != password && password.length >= 6; } void logout() { Sp.putUserName(null); Sp.putPassword(null); userName = null; password = null; _headerMap = null; } void refreshUserData({Function callback}) { Sp.getPassword((pw) { this.password = pw; }); Sp.getUserName((str) { this.userName = str; if (null != callback) { callback(); } }); Sp.getCookie((str) { this.cookie = str; _headerMap = null; }); Sp.getCookieExpires((str) { if (null != str && str.length > 0) { this.cookieExpiresTime = DateTime.parse(str); //提前3天请求新的cookie if (cookieExpiresTime.isAfter(DateUtil.getDaysAgo(3))) { Timer(Duration(milliseconds: 100), () { autoLogin(); }); } } }); } void login({Function callback}) { _saveUserInfo(CommonService().login(userName, password), userName, password, callback: callback); } void register({Function callback}) { _saveUserInfo( CommonService().register(userName, password), userName, password, callback: callback); } void _saveUserInfo( Future<Response> responseF, String userName, String password, {Function callback}) { responseF.then((response) { //实体处理 /*var userModel = UserModel.fromJson(response.data); if (userModel.errorCode == 0) { Sp.putUserName(userName); Sp.putPassword(password); String cookie = ""; DateTime expires; response.headers.forEach((String name, List<String> values) { if (name == "set-cookie") { cookie = json .encode(values) .replaceAll("\[\"", "") .replaceAll("\"\]", "") .replaceAll("\",\"", "; "); try { expires = DateUtil.formatExpiresTime(cookie); } catch (e) { expires = DateTime.now(); } } }); Sp.putCookie(cookie); Sp.putCookieExpires(expires.toIso8601String()); if (null != callback) callback(true, null); } else { if (null != callback) callback(false, userModel.errorMsg); }*/ }); } void autoLogin() { if (isLogin()) { login(); } } Map<String, String> getHeader() { if (null == _headerMap) { _headerMap = Map(); _headerMap["Cookie"] = cookie; } return _headerMap; } }
0
mirrored_repositories/coderiver-flutter/lib
mirrored_repositories/coderiver-flutter/lib/common/GlobalConfig.dart
import 'package:flutter/material.dart'; class GlobalConfig { ///颜色 static Color colorPrimary = Colors.blue; static Color color_tags = Color(0xFF009a61); static Color color_black = Color(0xFF000000); static Color color_dark_gray = Color(0xFF6b6b6b); static Color color_white_a80 = Color(0xccffffff); static Color color_blue = Color(0xcc0000ff); ///导航 static String homeTab = "首页"; static String secondTab = "二页"; static String thiredTab = "三页"; static String fourthTab = "四页"; static String fifthTab = "五页"; }
0
mirrored_repositories/coderiver-flutter/lib
mirrored_repositories/coderiver-flutter/lib/common/Sp.dart
import 'package:shared_preferences/shared_preferences.dart'; class Sp { static put(String key, String value) async { var prefs = await SharedPreferences.getInstance(); await prefs.setString(key, value); } static getS(String key, Function callback) async { SharedPreferences.getInstance().then((prefs) { callback(prefs.getString(key)); }); } static putUserName(String value) { put("username", value); } static putPassword(String value) { put("password", value); } static putCookie(String value) { put("cookie", value); } static putCookieExpires(String value) { put("expires", value); } static getUserName(Function callback) { getS("username", callback); } static getPassword(Function callback) { getS("password", callback); } static getCookie(Function callback) { getS("cookie", callback); } static getCookieExpires(Function callback) { getS("expires", callback); } }
0
mirrored_repositories/coderiver-flutter/lib
mirrored_repositories/coderiver-flutter/lib/common/ShowToast.dart
import 'dart:async'; import 'package:flutter/services.dart'; import 'package:meta/meta.dart'; enum Toast { LENGTH_SHORT, LENGTH_LONG } enum ToastGravity { TOP, BOTTOM, CENTER } class Fluttertoast { static const MethodChannel _channel = const MethodChannel('PonnamKarthik/fluttertoast'); static Future<String> showToast ({ @required String msg, Toast toastLength, int timeInSecForIos = 1, ToastGravity gravity, String bgcolor = "null", String textcolor = "null" }) async { String toast = "short"; if(toastLength == Toast.LENGTH_LONG) { toast = "long"; } String gravityToast = "bottom"; if(gravity == ToastGravity.TOP) { gravityToast = "top"; } else if(gravity == ToastGravity.CENTER) { gravityToast = "center"; } else { gravityToast = "bottom"; } final Map<String, dynamic> params = <String, dynamic> { 'msg': msg, 'length': toast, 'time': timeInSecForIos, 'gravity': gravityToast, 'bgcolor': bgcolor, 'textcolor': textcolor }; String res = await _channel.invokeMethod('showToast', params); return res; } }
0
mirrored_repositories/coderiver-flutter/lib
mirrored_repositories/coderiver-flutter/lib/utils/DateUtil.dart
class DateUtil { static DateTime formatExpiresTime(String str) { var expiresTime = RegExp("Expires[^;]*;").stringMatch(str).split(" ")[1].split("-"); var year = expiresTime[2]; var day = expiresTime[0]; var mounth = _getMounthByStr(expiresTime[1]); return DateTime.parse("$year$mounth$day"); } static DateTime getDaysAgo(int days) { return DateTime.now().subtract(Duration(days: days)); } static int _getMounthByStr(String str) { int output = 1; switch (str) { case "Jan": output = 1; break; case "Feb": output = 2; break; case "Mar": output = 3; break; case "Apr": output = 4; break; case "May": output = 5; break; case "Jun": output = 6; break; case "Jul": output = 7; break; case "Aug": output = 8; break; case "Sep": output = 9; break; case "Oct": output = 10; break; case "Nov": output = 11; break; case "Dec": output = 12; break; } return output; } }
0
mirrored_repositories/coderiver-flutter/lib
mirrored_repositories/coderiver-flutter/lib/utils/StringUtil.dart
class StringUtil { static bool isNullOrEmpty(String str) { return str == null || str.length <= 0; } }
0
mirrored_repositories/coderiver-flutter/lib
mirrored_repositories/coderiver-flutter/lib/ui/Application.dart
import 'package:coderiver/common/GlobalConfig.dart'; import 'package:coderiver/common/User.dart'; import 'package:coderiver/ui/home/HomePage.dart'; import 'package:coderiver/ui/home/MinePage.dart'; import 'package:coderiver/ui/home/SeconedPage.dart'; import 'package:flutter/material.dart'; class ApplicationPage extends StatefulWidget { @override State<StatefulWidget> createState() { return _ApplicationPageState(); } } class _ApplicationPageState extends State<ApplicationPage> with SingleTickerProviderStateMixin { int _page = 0; PageController _pageController; final List<BottomNavigationBarItem> _bottomTabs = <BottomNavigationBarItem>[ BottomNavigationBarItem( icon: new Icon(Icons.assignment), title: Text(GlobalConfig.homeTab), backgroundColor: GlobalConfig.colorPrimary), BottomNavigationBarItem( icon: new Icon(Icons.assignment), title: Text(GlobalConfig.secondTab), backgroundColor: GlobalConfig.colorPrimary), BottomNavigationBarItem( icon: new Icon(Icons.assignment), title: Text(GlobalConfig.thiredTab), backgroundColor: GlobalConfig.colorPrimary), ]; @override void initState() { super.initState(); _pageController = PageController(initialPage: this._page); } @override void dispose() { _pageController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { User().refreshUserData(); return Scaffold( body: PageView( physics: NeverScrollableScrollPhysics(), children: <Widget>[HomePage(), SeconedPage(), MinePage()], onPageChanged: onPageChanged, controller: _pageController, ), bottomNavigationBar: BottomNavigationBar( items: _bottomTabs, currentIndex: _page, fixedColor: GlobalConfig.colorPrimary, type: BottomNavigationBarType.fixed, onTap: onTap, ), ); } void onTap(int index) { _pageController.animateToPage(index, duration: const Duration(milliseconds: 300), curve: Curves.ease); } void onPageChanged(int page) { setState(() { this._page = page; }); } }
0
mirrored_repositories/coderiver-flutter/lib/ui
mirrored_repositories/coderiver-flutter/lib/ui/home/MinePage.dart
import 'package:coderiver/common/GlobalConfig.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class MinePage extends StatefulWidget { @override State<StatefulWidget> createState() { return _MinePageState(); } } class _MinePageState extends State<MinePage> with AutomaticKeepAliveClientMixin { @override bool get wantKeepAlive => null; @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(GlobalConfig.homeTab), centerTitle: true, actions: <Widget>[ IconButton( icon: new Icon(Icons.assignment), onPressed: () {}, ) ], ), body: Text(('开发中..'))); } }
0
mirrored_repositories/coderiver-flutter/lib/ui
mirrored_repositories/coderiver-flutter/lib/ui/home/SeconedPage.dart
import 'package:coderiver/common/GlobalConfig.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class SeconedPage extends StatefulWidget { @override State<StatefulWidget> createState() { return _SeconedPageState(); } } class _SeconedPageState extends State<SeconedPage> with AutomaticKeepAliveClientMixin { @override bool get wantKeepAlive => null; @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(GlobalConfig.homeTab), centerTitle: true, actions: <Widget>[ IconButton( icon: new Icon(Icons.assignment), onPressed: () {}, ) ], ), body: Text(('开发中..'))); } }
0
mirrored_repositories/coderiver-flutter/lib/ui
mirrored_repositories/coderiver-flutter/lib/ui/home/HomePage.dart
import 'package:coderiver/common/GlobalConfig.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class HomePage extends StatefulWidget { @override State<StatefulWidget> createState() { return _HomePageState(); } } class _HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin { @override bool get wantKeepAlive => null; @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(GlobalConfig.homeTab), centerTitle: true, actions: <Widget>[ IconButton( icon: new Icon(Icons.assignment), onPressed: () {}, ) ], ), body: Text(('开发中..'))); } }
0
mirrored_repositories/coderiver-flutter
mirrored_repositories/coderiver-flutter/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility that Flutter provides. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:coderiver/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/mlkit-in-flutter
mirrored_repositories/mlkit-in-flutter/lib/screens.dart
import 'dart:io'; import 'package:firebase_ml_vision/firebase_ml_vision.dart'; import 'package:flutter/material.dart'; class BarcodeScreen extends StatelessWidget { final List<Barcode> data; final File imageFile; BarcodeScreen({@required this.data, @required this.imageFile}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("Barcode Detector"), ), body: ListView.builder( itemCount: data.length, itemBuilder: (context, i) { return Card( child: Column( children: <Widget>[ Container( margin: EdgeInsets.all(20.0), height: 400.0, decoration: BoxDecoration( image: DecorationImage( image: FileImage(imageFile), fit: BoxFit.fitHeight, )), ), Text("Type : " + data[i].valueType.toString()), Text("Raw Value : " + data[i].rawValue), Text("Bounding Points : " + data[i].boundingBox.toString()), ], ), ); }, ), ); } } class Facedata extends StatelessWidget { final List<Face> data; final File imageFile; Facedata({@required this.data, @required this.imageFile}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("Face Recog"), ), body: ListView.builder( itemCount: data.length, itemBuilder: (context, i) { return Card( child: Column( children: <Widget>[ Container( margin: EdgeInsets.all(20.0), height: 400.0, decoration: BoxDecoration( image: DecorationImage( image: FileImage(imageFile), fit: BoxFit.fitHeight, )), ), Text("Rotation Y : " + data[i].headEulerAngleY.toString()), Text("Rotation Z : " + data[i].headEulerAngleZ.toString()), Text("Left Eye Open Probability : " + data[i].leftEyeOpenProbability.toString()), Text("Right Eye Open Probability : " + data[i].rightEyeOpenProbability.toString()), ], ), ); }, ), ); } } class GetText extends StatelessWidget { final List<TextBlock> data; final File imageFile; GetText({@required this.data, @required this.imageFile}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("Text Recog"), ), body: ListView( children: <Widget>[ Column( children: <Widget>[ Container( margin: EdgeInsets.all(20.0), height: 400.0, decoration: BoxDecoration( image: DecorationImage( image: FileImage(imageFile), fit: BoxFit.fitHeight, )), ), ListView.builder( shrinkWrap: true, primary: false, itemCount: data.length, itemBuilder: (context, i) { return Card( child: Column( children: <Widget>[ Text("Text : " + data[i].text.toString()), Text("Languages : " + data[i].recognizedLanguages.toString()), ], ), ); }, ), ], )], )); } }
0
mirrored_repositories/mlkit-in-flutter
mirrored_repositories/mlkit-in-flutter/lib/main.dart
import 'dart:io'; import 'package:face_detection_app/screens.dart'; import 'package:flutter/material.dart'; import 'package:firebase_ml_vision/firebase_ml_vision.dart'; import 'package:image_picker/image_picker.dart'; void main()=>runApp( MaterialApp( title: 'Face Regonisation', home: Home(), ) ); class Home extends StatefulWidget { @override _HomeState createState() => _HomeState(); } class _HomeState extends State<Home> { Future<File> getImage() async{ return ImagePicker.pickImage(source: ImageSource.gallery); } List<Face> faceListEntities; List<Barcode> barcodes; List<ImageLabel> labels; VisionText visionText; final FaceDetector faceDetector = FirebaseVision.instance.faceDetector(); final BarcodeDetector barcodeDetector = FirebaseVision.instance.barcodeDetector(); final ImageLabeler labeler = FirebaseVision.instance.imageLabeler(); final TextRecognizer textRecognizer = FirebaseVision.instance.textRecognizer(); void detectFace()async{ File imageFile = await getImage(); final FirebaseVisionImage visionImage = FirebaseVisionImage.fromFile(imageFile); faceListEntities = await faceDetector.processImage(visionImage); print(faceListEntities); Navigator.push(context, MaterialPageRoute(builder: (context)=>Facedata(data: faceListEntities, imageFile: imageFile,).build(context))); } void scanBarCode()async{ File imageFile = await getImage(); final FirebaseVisionImage visionImage = FirebaseVisionImage.fromFile(imageFile); barcodes = await barcodeDetector.detectInImage(visionImage); print(barcodes); Navigator.push(context, MaterialPageRoute(builder: (context)=>BarcodeScreen(data: barcodes, imageFile: imageFile,))); } void textRecog()async{ File imageFile = await getImage(); final FirebaseVisionImage visionImage = FirebaseVisionImage.fromFile(imageFile); visionText = await textRecognizer.processImage(visionImage); Navigator.push(context, MaterialPageRoute(builder: (context)=>GetText(data: visionText.blocks, imageFile: imageFile,).build(context))); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("ML Kit"), ), body: Container( child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ SizedBox(height: 50.0,), Text("Hands on ML Kit", style: TextStyle( fontSize: 30.0, fontWeight: FontWeight.bold, ),), SizedBox(height: 50.0,), Center( child: RaisedButton( onPressed: (){ detectFace(); }, child: Text("Detect Face"), ), ), Center( child: RaisedButton( onPressed: (){ scanBarCode(); }, child: Text("Scan BarCode"), ), ), Center( child: RaisedButton( onPressed: (){ textRecog(); }, child: Text("Text Recog"), ), ), ], ) ), ); } }
0
mirrored_repositories/mlkit-in-flutter
mirrored_repositories/mlkit-in-flutter/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility that Flutter provides. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:face_detection_app/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/Store-App-UI
mirrored_repositories/Store-App-UI/lib/main.dart
import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:small_store_app/constants/color_constants.dart'; import 'package:small_store_app/screens/home_screen.dart'; // This will always work for lock screen Orientation. void main() async { WidgetsFlutterBinding.ensureInitialized(); await SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, ]); runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); // This widget is the root of application. @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, title: 'Small Store App', theme: ThemeData( scaffoldBackgroundColor: lightScaffoldColor, primaryColor: lightCardColor, appBarTheme: AppBarTheme( actionsIconTheme: const IconThemeData( color: Colors.black, ), iconTheme: IconThemeData( color: lightIconsColor, ), backgroundColor: lightScaffoldColor, centerTitle: true, titleTextStyle: TextStyle( color: lightTextColor, fontSize: 22, fontWeight: FontWeight.bold, ), elevation: 0, ), iconTheme: IconThemeData( color: lightIconsColor, ), textSelectionTheme: const TextSelectionThemeData( cursorColor: Colors.black, selectionColor: Colors.blue, // selectionHandleColor: Colors.blue, ), // textTheme: TextTheme() // textTheme: Theme.of(context).textTheme.apply( // bodyColor: Colors.black, // displayColor: Colors.black, // ), cardColor: lightCardColor, brightness: Brightness.light, colorScheme: ThemeData() .colorScheme .copyWith( secondary: lightIconsColor, brightness: Brightness.light, ) .copyWith(background: lightBackgroundColor), ), home: const HomeScreen(), ); } }
0
mirrored_repositories/Store-App-UI/lib
mirrored_repositories/Store-App-UI/lib/constants/color_constants.dart
import 'package:flutter/material.dart'; //Light theme Color lightScaffoldColor = const Color(0xFFF8F8F8); Color lightCardColor = const Color(0xFFFfFFFf); //F0FFFF Color lightBackgroundColor = const Color(0xFFD0E8F2); Color lightIconsColor = const Color.fromARGB(255, 175, 0, 120); Color lightTextColor = const Color(0xff324558);
0
mirrored_repositories/Store-App-UI/lib
mirrored_repositories/Store-App-UI/lib/constants/api_const.dart
const String Base_URL = 'api.escuelajs.co';
0
mirrored_repositories/Store-App-UI/lib
mirrored_repositories/Store-App-UI/lib/model/products_model.dart
import 'package:small_store_app/model/category_model.dart'; class ProductsModel { int? id; String? title; int? price; String? description; List<String>? images; String? creationAt; String? updatedAt; CategoryModel? category; ProductsModel( {this.id, this.title, this.price, this.description, this.images, this.creationAt, this.updatedAt, this.category}); ProductsModel.fromJson(Map<String, dynamic> json) { id = json['id']; title = json['title']; price = json['price']; description = json['description']; images = json['images'].cast<String>(); creationAt = json['creationAt']; updatedAt = json['updatedAt']; category = json['category'] != null ? CategoryModel.fromJson(json['category']) : null; } static List<ProductsModel> productSnapshots(List dataList) { return dataList.map((e) { return ProductsModel.fromJson(e); }).toList(); } // Map<String, dynamic> toJson() { // final Map<String, dynamic> data = <String, dynamic>{}; // data['id'] = id; // data['title'] = title; // data['price'] = price; // data['description'] = description; // data['images'] = images; // data['creationAt'] = creationAt; // data['updatedAt'] = updatedAt; // if (category != null) { // data['category'] = category!.toJson(); // } // return data; // } } class Category { int? id; String? name; String? image; String? creationAt; String? updatedAt; Category({ this.id, this.name, this.image, this.creationAt, this.updatedAt, }); Category.fromJson(Map<String, dynamic> json) { id = json['id']; name = json['name']; image = json['image']; creationAt = json['creationAt']; updatedAt = json['updatedAt']; } Map<String, dynamic> toJson() { final Map<String, dynamic> data = <String, dynamic>{}; data['id'] = id; data['name'] = name; data['image'] = image; data['creationAt'] = creationAt; data['updatedAt'] = updatedAt; return data; } }
0
mirrored_repositories/Store-App-UI/lib
mirrored_repositories/Store-App-UI/lib/model/category_model.dart
class CategoryModel { int? id; String? name; String? image; String? creationAt; String? updatedAt; CategoryModel({ this.id, this.name, this.image, this.creationAt, this.updatedAt, }); CategoryModel.fromJson(Map<String, dynamic> json) { id = json['id']; name = json['name']; image = json['image']; creationAt = json['creationAt']; updatedAt = json['updatedAt']; } Map<String, dynamic> toJson() { final Map<String, dynamic> data = {}; data['id'] = id; data['name'] = name; data['image'] = image; data['creationAt'] = creationAt; data['updatedAt'] = updatedAt; return data; } static List<CategoryModel> categorySnapshots(List dataList) { return dataList.map((e) { return CategoryModel.fromJson(e); }).toList(); } }
0
mirrored_repositories/Store-App-UI/lib
mirrored_repositories/Store-App-UI/lib/widget/item_feeds.dart
import 'package:fancy_shimmer_image/fancy_shimmer_image.dart'; import 'package:flutter/material.dart'; import 'package:flutter_iconly/flutter_iconly.dart'; import 'package:page_transition/page_transition.dart'; import 'package:small_store_app/constants/color_constants.dart'; import 'package:small_store_app/screens/product_details.dart'; class ItemFeeds extends StatelessWidget { const ItemFeeds({ Key? key, required this.image, required this.title, }) : super(key: key); final String title; final String image; @override Widget build(BuildContext context) { Size size = MediaQuery.of(context).size; return Padding( padding: const EdgeInsets.all(2.0), child: Material( borderRadius: BorderRadius.circular(8.0), color: Theme.of(context).cardColor, child: InkWell( borderRadius: BorderRadius.circular(8.0), onTap: () { Navigator.push( context, PageTransition( child: const ProductDetails(), type: PageTransitionType.fade), ); }, child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only( left: 5, right: 5, top: 8, ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Flexible( child: RichText( text: TextSpan( text: '\$', style: const TextStyle( color: Color.fromRGBO(33, 150, 243, 1)), children: <TextSpan>[ TextSpan( text: "168.00", style: TextStyle( color: lightTextColor, fontWeight: FontWeight.w600, ), ), ]), ), ), const Icon(IconlyLight.heart), ], ), ), const SizedBox(height: 20), ClipRRect( borderRadius: BorderRadius.circular(12), child: FancyShimmerImage( height: size.height * 0.2, width: double.infinity, errorWidget: const Icon( IconlyBold.danger, color: Colors.red, size: 28, ), imageUrl: image, boxFit: BoxFit.fill, ), ), const SizedBox(height: 10), Padding( padding: EdgeInsets.all(8.0), child: Text( title, overflow: TextOverflow.ellipsis, maxLines: 2, style: TextStyle( fontSize: 15, // fontFamily: 'Roboto', fontWeight: FontWeight.w700, ), ), ), SizedBox( height: size.height * 0.01, ), ], ), ), ), ), ); } }
0
mirrored_repositories/Store-App-UI/lib
mirrored_repositories/Store-App-UI/lib/widget/category_widgets.dart
import 'package:fancy_shimmer_image/fancy_shimmer_image.dart'; import 'package:flutter/material.dart'; import 'package:flutter_iconly/flutter_iconly.dart'; class CategoryWidget extends StatelessWidget { const CategoryWidget({ Key? key, required this.image, }) : super(key: key); final String image; @override Widget build(BuildContext context) { Size size = MediaQuery.of(context).size; return Padding( padding: const EdgeInsets.all(8.0), child: Stack( children: [ ClipRRect( borderRadius: BorderRadius.circular(12), child: FancyShimmerImage( height: size.width * 0.45, width: size.width * 0.45, errorWidget: const Icon( IconlyBold.danger, color: Colors.red, size: 28, ), imageUrl: image, boxFit: BoxFit.fill, ), ), const Align( alignment: Alignment.bottomCenter, child: Text( "Categ name", textAlign: TextAlign.center, style: TextStyle( fontSize: 20, fontWeight: FontWeight.w400, ), ), ) ], ), ); } }
0
mirrored_repositories/Store-App-UI/lib
mirrored_repositories/Store-App-UI/lib/widget/appbar_icons.dart
import 'package:flutter/material.dart'; class AppBarIcons extends StatelessWidget { const AppBarIcons({ Key? key, required this.function, required this.icon, }) : super(key: key); final Function function; final IconData icon; @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.all(5.0), child: GestureDetector( onTap: () { function(); }, child: Container( decoration: BoxDecoration( shape: BoxShape.rectangle, color: Theme.of(context).cardColor, ), child: Padding( padding: const EdgeInsets.all(6.0), child: Icon( icon, color: Colors.black, ), ), )), ); } }
0
mirrored_repositories/Store-App-UI/lib
mirrored_repositories/Store-App-UI/lib/widget/sale_widget.dart
import 'package:flutter/material.dart'; class SaleWidget extends StatelessWidget { const SaleWidget({Key? key}) : super(key: key); @override Widget build(BuildContext context) { Size size = MediaQuery.of(context).size; return Container( width: double.infinity, height: size.height * 0.3, decoration: BoxDecoration( borderRadius: BorderRadius.circular(18), gradient: const LinearGradient( colors: [ Color.fromARGB(255, 66, 16, 147), Color.fromARGB(255, 114, 154, 171), ], begin: FractionalOffset(0.0, 0.0), end: FractionalOffset(1.0, 0.0), stops: [0.0, 1.0], tileMode: TileMode.clamp, ), ), child: Row( children: [ Flexible( flex: 2, child: Padding( padding: const EdgeInsets.all(14.0), child: Container( height: double.infinity, decoration: BoxDecoration( color: const Color.fromARGB(255, 112, 99, 169), borderRadius: BorderRadius.circular(15), ), child: const Padding( padding: EdgeInsets.all(5.0), child: Column( // mainAxisSize: MainAxisSize.max, // mainAxisAlignment: MainAxisAlignment.center, // crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( "Special discount", style: TextStyle( fontSize: 20, color: Colors.white, fontWeight: FontWeight.bold, ), ), SizedBox( height: 15, ), Flexible( child: SizedBox( width: double.infinity, child: FittedBox( fit: BoxFit.fill, child: Text( "50 %\nOFF", style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, // fontSize: 300, ), ), ), ), ), ], ), ), ), ), ), Flexible( flex: 2, child: Padding( padding: const EdgeInsets.all(14.0), child: Image.network( width: double.infinity, // height: double.infinity, "https://i.ibb.co/vwB46Yq/shoes.png", fit: BoxFit.contain, ), ), ), ], ), ); } }
0
mirrored_repositories/Store-App-UI/lib
mirrored_repositories/Store-App-UI/lib/widget/user_widget.dart
import 'package:fancy_shimmer_image/fancy_shimmer_image.dart'; import 'package:flutter/material.dart'; import 'package:flutter_iconly/flutter_iconly.dart'; import 'package:small_store_app/constants/color_constants.dart'; class UsersWidget extends StatelessWidget { const UsersWidget({Key? key}) : super(key: key); @override Widget build(BuildContext context) { Size size = MediaQuery.of(context).size; return ListTile( leading: FancyShimmerImage( height: size.width * 0.15, width: size.width * 0.15, errorWidget: const Icon( IconlyBold.danger, color: Colors.red, size: 28, ), imageUrl: "https://www.shareicon.net/data/512x512/2016/08/05/806962_user_512x512.png", boxFit: BoxFit.fill, ), title: const Text("User name"), subtitle: const Text("Email@email.com"), trailing: Text( "User role", style: TextStyle( color: lightIconsColor, fontWeight: FontWeight.bold, ), ), ); } }
0
mirrored_repositories/Store-App-UI/lib
mirrored_repositories/Store-App-UI/lib/services/api_services.dart
import 'dart:convert'; import 'package:http/http.dart' as http; import 'package:small_store_app/constants/api_const.dart'; import 'package:small_store_app/model/category_model.dart'; import 'package:small_store_app/model/products_model.dart'; class ProductsApiServices { static Future<List<ProductsModel>> productiapiServices() async { var uri = Uri.https(Base_URL, '/api/v1/products'); var response = await http.get(uri); var data = json.decode(response.body); print('Response Data ${json.decode(response.body)}'); List dataList = []; for (var v in data) { dataList.add(v); } return ProductsModel.productSnapshots(dataList); } static Future<List<CategoryModel>> categoryapiServices() async { var uri = Uri.https(Base_URL, '/api/v1/category'); var response = await http.get(uri); var data = json.decode(response.body); print('Response Data ${json.decode(response.body)}'); List dataList = []; for (var v in data) { dataList.add(v); } return CategoryModel.categorySnapshots(dataList); } }
0
mirrored_repositories/Store-App-UI/lib
mirrored_repositories/Store-App-UI/lib/screens/user_screen.dart
import 'package:flutter/material.dart'; import 'package:small_store_app/widget/user_widget.dart'; class UsersScreen extends StatelessWidget { const UsersScreen({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text("Categories")), body: ListView.builder( itemCount: 10, itemBuilder: (ctx, index) { return const UsersWidget(); })); } }
0
mirrored_repositories/Store-App-UI/lib
mirrored_repositories/Store-App-UI/lib/screens/all_products.dart
import 'package:flutter/material.dart'; import 'package:small_store_app/model/products_model.dart'; import 'package:small_store_app/services/api_services.dart'; import 'package:small_store_app/widget/item_feeds.dart'; class AllProducts extends StatefulWidget { const AllProducts({Key? key}) : super(key: key); @override State<AllProducts> createState() => _AllProductsState(); } class _AllProductsState extends State<AllProducts> { late List<ProductsModel> productmodelList; @override void didChangeDependencies() { getData(); super.didChangeDependencies(); } Future<void> getData() async { productmodelList = await ProductsApiServices.productiapiServices(); setState(() {}); } @override Widget build(BuildContext context) { return GestureDetector( onTap: () { FocusScope.of(context).unfocus(); }, child: Scaffold( appBar: AppBar( // elevation: 4, title: const Text('PRODUCTS'), ), body: Padding( padding: const EdgeInsets.all(10.0), child: Column( children: [ const SizedBox( height: 20, ), Expanded( child: SingleChildScrollView( child: Column( children: [ const SizedBox( height: 15, ), GridView.builder( itemCount: productmodelList.length, shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: 5.0, mainAxisSpacing: 1.0, childAspectRatio: 0.7, ), itemBuilder: (context, index) { return ItemFeeds( image: productmodelList[index].images![0], title: productmodelList[index].title.toString(), ); }, ) ], ), ), ) ], ), ), ), ); } }
0
mirrored_repositories/Store-App-UI/lib
mirrored_repositories/Store-App-UI/lib/screens/home_screen.dart
import 'package:card_swiper/card_swiper.dart'; import 'package:flutter/material.dart'; import 'package:flutter_iconly/flutter_iconly.dart'; import 'package:page_transition/page_transition.dart'; import 'package:small_store_app/model/products_model.dart'; import 'package:small_store_app/screens/all_products.dart'; import 'package:small_store_app/screens/category_screen.dart'; import 'package:small_store_app/screens/user_screen.dart'; import 'package:small_store_app/services/api_services.dart'; import 'package:small_store_app/widget/appbar_icons.dart'; import 'package:small_store_app/widget/item_feeds.dart'; import 'package:small_store_app/widget/sale_widget.dart'; class HomeScreen extends StatefulWidget { const HomeScreen({Key? key}) : super(key: key); @override State<HomeScreen> createState() => _HomeScreenState(); } class _HomeScreenState extends State<HomeScreen> { List<ProductsModel> productmodelList = []; @override void initState() { textController = TextEditingController(); super.initState(); } @override void dispose() { super.dispose(); } @override void didChangeDependencies() { getData(); super.didChangeDependencies(); } Future<void> getData() async { productmodelList = await ProductsApiServices.productiapiServices(); } late TextEditingController textController; @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; return GestureDetector( onTap: () { FocusScope.of(context).unfocus(); }, child: Scaffold( appBar: AppBar( // elevation: 4, title: const Text('Home'), leading: AppBarIcons( function: () { Navigator.push( context, PageTransition( child: const CategoriesScreen(), type: PageTransitionType.fade, ), ); }, icon: IconlyLight.category, ), actions: [ AppBarIcons( function: () { Navigator.push( context, PageTransition( child: const UsersScreen(), type: PageTransitionType.fade, ), ); }, icon: IconlyLight.user2, ), ], ), body: Padding( padding: const EdgeInsets.all(10.0), child: Column( children: [ const SizedBox( height: 20, ), TextField( controller: textController, keyboardType: TextInputType.text, decoration: InputDecoration( hintText: 'Search', suffixIcon: const Icon(IconlyLight.search), border: OutlineInputBorder( borderRadius: BorderRadius.circular(5.0), ), focusedBorder: OutlineInputBorder( borderSide: BorderSide( color: Theme.of(context).highlightColor, ))), ), const SizedBox( height: 15, ), Expanded( child: SingleChildScrollView( child: Column( children: [ SizedBox( height: size.height * 0.3, child: Swiper( itemCount: 3, itemBuilder: (context, index) { return const SaleWidget(); }, pagination: const SwiperPagination( margin: EdgeInsets.only( top: 15, bottom: 5, ), alignment: Alignment.bottomCenter, builder: DotSwiperPaginationBuilder( activeColor: Colors.black, )), ), ), const SizedBox( height: 15, ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ const Text( "ALL PRODUCTS", style: TextStyle( fontWeight: FontWeight.bold, fontSize: 20, ), ), AppBarIcons( function: () { Navigator.push( context, PageTransition( child: AllProducts(), type: PageTransitionType.bottomToTop, )); }, icon: IconlyLight.arrowRight, ), ], ), Column( children: [ GridView.builder( itemCount: productmodelList.length, shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: 5.0, mainAxisSpacing: 1.0, childAspectRatio: 0.7, ), itemBuilder: (context, index) { return ItemFeeds( image: productmodelList[index].images![0], title: productmodelList[index].title.toString(), // price: productmodelList[index].price!.toInt(), ); }, ), ], ) ], ), ), ) ], ), ), ), ); } }
0
mirrored_repositories/Store-App-UI/lib
mirrored_repositories/Store-App-UI/lib/screens/category_screen.dart
import 'package:flutter/material.dart'; import 'package:small_store_app/model/category_model.dart'; import 'package:small_store_app/widget/category_widgets.dart'; class CategoriesScreen extends StatelessWidget { const CategoriesScreen({Key? key}) : super(key: key); @override Widget build(BuildContext context) { List<CategoryModel> categorymodelList = []; return Scaffold( appBar: AppBar(title: const Text("Categories")), body: GridView.builder( shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), itemCount: 3, gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: 0.0, mainAxisSpacing: 0.0, childAspectRatio: 1.2, ), itemBuilder: (ctx, index) { return CategoryWidget( image: categorymodelList[index].image![0], ); }), ); } }
0