Skip to content

Commit

Permalink
new gmail like floating action button added
Browse files Browse the repository at this point in the history
  • Loading branch information
iampawan committed Mar 15, 2019
1 parent 30d834d commit c275998
Showing 1 changed file with 41 additions and 2 deletions.
43 changes: 41 additions & 2 deletions lib/ui/page/timeline/timeline_two_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,51 @@ class TimelineTwoPageState extends State<TimelineTwoPage> {
child: FloatingActionButton(
onPressed: () {},
backgroundColor: Colors.white,
child: Icon(
Icons.add,
child: CustomPaint(
child: Container(),
foregroundPainter: FloatingPainter(),
),
),
),
),
);
}
}

class FloatingPainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
Paint amberPaint = Paint()
..color = Colors.amber
..strokeWidth = 5;

Paint greenPaint = Paint()
..color = Colors.green
..strokeWidth = 5;

Paint bluePaint = Paint()
..color = Colors.blue
..strokeWidth = 5;

Paint redPaint = Paint()
..color = Colors.red
..strokeWidth = 5;

canvas.drawLine(Offset(size.width * 0.27, size.height * 0.5),
Offset(size.width * 0.5, size.height * 0.5), amberPaint);
canvas.drawLine(
Offset(size.width * 0.5, size.height * 0.5),
Offset(size.width * 0.5, size.height - (size.height * 0.27)),
greenPaint);
canvas.drawLine(Offset(size.width * 0.5, size.height * 0.5),
Offset(size.width - (size.width * 0.27), size.height * 0.5), bluePaint);
canvas.drawLine(Offset(size.width * 0.5, size.height * 0.5),
Offset(size.width * 0.5, size.height * 0.27), redPaint);
}

@override
bool shouldRepaint(FloatingPainter oldDelegate) => false;

@override
bool shouldRebuildSemantics(FloatingPainter oldDelegate) => false;
}

0 comments on commit c275998

Please sign in to comment.