-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from 90lucasgabriel/25-components
25 - Extras
- Loading branch information
Showing
9 changed files
with
137 additions
and
5 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
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
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,28 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'package:quiz/core/core.dart'; | ||
import 'package:quiz/home/widgets/skeleton/skeleton_widget.dart'; | ||
|
||
class QuizCardSkeletonWidget extends StatelessWidget { | ||
const QuizCardSkeletonWidget({ | ||
Key? key, | ||
}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Container( | ||
decoration: BoxDecoration( | ||
color: AppColors.white, | ||
borderRadius: BorderRadius.circular(10), | ||
border: Border.fromBorderSide( | ||
BorderSide( | ||
color: AppColors.border, | ||
), | ||
), | ||
), | ||
child: Skeleton( | ||
borderRadius: 9, | ||
), | ||
); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
lib/home/widgets/score_card/score_card_skeleton_widget.dart
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,28 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:quiz/core/core.dart'; | ||
import 'package:quiz/home/widgets/skeleton/skeleton_widget.dart'; | ||
|
||
class ScoreCardSkeletonWidget extends StatelessWidget { | ||
const ScoreCardSkeletonWidget({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Container( | ||
margin: EdgeInsets.symmetric(horizontal: 16), | ||
height: 136, | ||
decoration: BoxDecoration( | ||
color: AppColors.white, | ||
borderRadius: BorderRadius.circular(15), | ||
boxShadow: [ | ||
BoxShadow( | ||
color: Colors.grey.withOpacity(0.2), | ||
spreadRadius: 2, | ||
blurRadius: 5, | ||
offset: Offset(0, 2), | ||
), | ||
], | ||
), | ||
child: Skeleton(borderRadius: 14), | ||
); | ||
} | ||
} |
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,64 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:quiz/core/core.dart'; | ||
|
||
class Skeleton extends StatefulWidget { | ||
final double height; | ||
final double width; | ||
final double borderRadius; | ||
|
||
Skeleton({ | ||
Key? key, | ||
this.height = 1000, | ||
this.width = 1000, | ||
this.borderRadius = 0, | ||
}) : super(key: key); | ||
|
||
createState() => SkeletonState(); | ||
} | ||
|
||
class SkeletonState extends State<Skeleton> | ||
with SingleTickerProviderStateMixin { | ||
late AnimationController _controller; | ||
|
||
late Animation gradientPosition; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
_controller = AnimationController( | ||
duration: Duration(milliseconds: 1500), vsync: this); | ||
|
||
gradientPosition = Tween<double>( | ||
begin: -3, | ||
end: 10, | ||
).animate( | ||
CurvedAnimation(parent: _controller, curve: Curves.linear), | ||
)..addListener(() { | ||
setState(() {}); | ||
}); | ||
|
||
_controller.repeat(); | ||
} | ||
|
||
@override | ||
void dispose() { | ||
super.dispose(); | ||
_controller.dispose(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Container( | ||
width: widget.width, | ||
height: widget.height, | ||
decoration: BoxDecoration( | ||
borderRadius: BorderRadius.circular(widget.borderRadius), | ||
gradient: LinearGradient( | ||
begin: Alignment(gradientPosition.value, 0), | ||
end: Alignment(-1, 0), | ||
colors: [AppColors.border, Colors.white10, AppColors.border], | ||
), | ||
), | ||
); | ||
} | ||
} |
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