Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
KagurazakaHanabi
committed
Jul 11, 2019
1 parent
81325f6
commit 912bb5a
Showing
7 changed files
with
92 additions
and
18 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import 'dart:ui'; | ||
|
||
import 'package:flutter/cupertino.dart'; | ||
|
||
class Divider extends StatelessWidget { | ||
final List<Color> colors; | ||
|
||
final double height; | ||
|
||
Divider({ | ||
Key key, | ||
@required this.colors, | ||
this.height = 0.5, | ||
}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return CustomPaint( | ||
size: Size(window.physicalSize.width, height), | ||
painter: _DividerPainter(this.colors), | ||
); | ||
} | ||
} | ||
|
||
class _DividerPainter extends CustomPainter { | ||
final List<Color> colors; | ||
|
||
_DividerPainter(this.colors); | ||
|
||
@override | ||
void paint(Canvas canvas, Size size) { | ||
double width = size.width / colors.length; | ||
for (int i = 0; i < colors.length; i++) { | ||
Paint paint = Paint()..color = colors[i]; | ||
canvas.drawRect(Rect.fromLTWH(width * i, 0, width, size.height), paint); | ||
} | ||
} | ||
|
||
@override | ||
bool shouldRepaint(_) => false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters