-
Notifications
You must be signed in to change notification settings - Fork 295
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
1 parent
bc22939
commit a5b1eb4
Showing
7 changed files
with
251 additions
and
2 deletions.
There are no files selected for viewing
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,32 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
/// Nice reads | ||
/// https://medium.com/swlh/flutter-custom-tab-indicator-for-tabbar-d72bbc6c9d0c | ||
/// https://medium.com/flutter-community/flutter-custom-decoration-eba31253be0b | ||
class CircleTabIndicator extends Decoration { | ||
final BoxPainter _painter; | ||
|
||
CircleTabIndicator({required Color color, required double radius}) | ||
: _painter = _CirclePainter(color, radius); | ||
|
||
@override | ||
BoxPainter createBoxPainter([VoidCallback? onChanged]) => _painter; | ||
} | ||
|
||
class _CirclePainter extends BoxPainter { | ||
final Paint _paint; | ||
final double radius; | ||
|
||
_CirclePainter(Color color, this.radius) | ||
: _paint = Paint() | ||
..color = color | ||
..isAntiAlias = true; | ||
|
||
@override | ||
void paint(Canvas canvas, Offset offset, ImageConfiguration cfg) { | ||
final Offset circleOffset = | ||
offset + Offset(cfg.size!.width / 2, cfg.size!.height - radius - 5); | ||
canvas.drawCircle(circleOffset, radius, _paint); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -89,6 +89,8 @@ flutter: | |
- assets/svg/18/ | ||
- assets/svg/19/ | ||
- assets/svg/21/ | ||
- assets/svg/32/ | ||
|
||
|
||
|
||
|
||
|