Skip to content

Commit

Permalink
Changed placeholder and errorwidget for Cached Images and tweaked few…
Browse files Browse the repository at this point in the history
… animations
  • Loading branch information
ShreeyansB committed Jul 20, 2021
1 parent 094c165 commit 8740002
Show file tree
Hide file tree
Showing 10 changed files with 197 additions and 54 deletions.
24 changes: 20 additions & 4 deletions lib/components/gen_code_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,26 @@ class _CodeGenState extends State<CodeGen> {
),
),
),
placeholder: (context, url) => SizedBox(
height: 50,
child: Center(child: CircularProgressIndicator())),
errorWidget: (context, url, error) => Icon(Icons.error),
placeholder: (context, url) => Container(
decoration: BoxDecoration(
borderRadius: MyTheme.borderRadius,
border: Border.all(
color: Colors.black12, width: 1)),
child: Center(
child: CircularProgressIndicator(
color: Colors.black12,
strokeWidth: 2,
))),
errorWidget: (context, url, error) => Container(
decoration: BoxDecoration(
borderRadius: MyTheme.borderRadius,
border: Border.all(
color: Colors.black12, width: 1)),
child: Center(
child: Icon(
Icons.error,
color: Colors.black12,
))),
),
),
);
Expand Down
24 changes: 20 additions & 4 deletions lib/components/gen_para_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,26 @@ class _ParaGenState extends State<ParaGen> {
),
),
),
placeholder: (context, url) => SizedBox(
height: 50,
child: Center(child: CircularProgressIndicator())),
errorWidget: (context, url, error) => Icon(Icons.error),
placeholder: (context, url) => Container(
decoration: BoxDecoration(
borderRadius: MyTheme.borderRadius,
border: Border.all(
color: Colors.black12, width: 1)),
child: Center(
child: CircularProgressIndicator(
color: Colors.black12,
strokeWidth: 2,
))),
errorWidget: (context, url, error) => Container(
decoration: BoxDecoration(
borderRadius: MyTheme.borderRadius,
border: Border.all(
color: Colors.black12, width: 1)),
child: Center(
child: Icon(
Icons.error,
color: Colors.black12,
))),
),
),
);
Expand Down
67 changes: 56 additions & 11 deletions lib/components/image_carousel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,24 @@ class ImageCarousel extends StatelessWidget {
),
),
),
placeholder: (context, url) => SizedBox(
height: 100,
child: Center(child: CircularProgressIndicator())),
errorWidget: (context, url, error) => Icon(Icons.error),
placeholder: (context, url) => Container(
decoration: BoxDecoration(
borderRadius: MyTheme.borderRadius,
border: Border.all(color: Colors.black12, width: 1)),
child: Center(
child: CircularProgressIndicator(
color: Colors.black12,
strokeWidth: 2,
))),
errorWidget: (context, url, error) => Container(
decoration: BoxDecoration(
borderRadius: MyTheme.borderRadius,
border: Border.all(color: Colors.black12, width: 1)),
child: Center(
child: Icon(
Icons.error,
color: Colors.black12,
))),
),
);
},
Expand Down Expand Up @@ -106,10 +120,26 @@ class ImageCarousel extends StatelessWidget {
),
),
),
placeholder: (context, url) => SizedBox(
height: 100,
child: Center(child: CircularProgressIndicator())),
errorWidget: (context, url, error) => Icon(Icons.error),
placeholder: (context, url) => Container(
decoration: BoxDecoration(
borderRadius: MyTheme.borderRadius,
border:
Border.all(color: Colors.black12, width: 1)),
child: Center(
child: CircularProgressIndicator(
color: Colors.black12,
strokeWidth: 2,
))),
errorWidget: (context, url, error) => Container(
decoration: BoxDecoration(
borderRadius: MyTheme.borderRadius,
border:
Border.all(color: Colors.black12, width: 1)),
child: Center(
child: Icon(
Icons.error,
color: Colors.black12,
))),
),
),
);
Expand Down Expand Up @@ -159,9 +189,24 @@ class HomeImageCarousel extends StatelessWidget {
),
),
),
placeholder: (context, url) => SizedBox(
height: 100, child: Center(child: CircularProgressIndicator())),
errorWidget: (context, url, error) => Icon(Icons.error),
placeholder: (context, url) => Container(
decoration: BoxDecoration(
borderRadius: MyTheme.borderRadius,
border: Border.all(color: Colors.black12, width: 1)),
child: Center(
child: CircularProgressIndicator(
color: Colors.black12,
strokeWidth: 2,
))),
errorWidget: (context, url, error) => Container(
decoration: BoxDecoration(
borderRadius: MyTheme.borderRadius,
border: Border.all(color: Colors.black12, width: 1)),
child: Center(
child: Icon(
Icons.error,
color: Colors.black12,
))),
),
);
},
Expand Down
22 changes: 18 additions & 4 deletions lib/components/image_viewer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,24 @@ class _ImageViewerState extends State<ImageViewer>
),
),
),
placeholder: (context, url) => SizedBox(
height: 100,
child: Center(child: CircularProgressIndicator())),
errorWidget: (context, url, error) => Icon(Icons.error),
placeholder: (context, url) => Container(
decoration: BoxDecoration(
borderRadius: MyTheme.borderRadius,
border: Border.all(color: Colors.black12, width: 1)),
child: Center(
child: CircularProgressIndicator(
color: Colors.black12,
strokeWidth: 2,
))),
errorWidget: (context, url, error) => Container(
decoration: BoxDecoration(
borderRadius: MyTheme.borderRadius,
border: Border.all(color: Colors.black12, width: 1)),
child: Center(
child: Icon(
Icons.error,
color: Colors.black12,
))),
),
),
),
Expand Down
1 change: 1 addition & 0 deletions lib/components/side_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class _SideMenuState extends State<SideMenu> {
return Drawer(
elevation: 2,
child: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Padding(
padding: EdgeInsets.only(bottom: 30.0),
child: Column(
Expand Down
12 changes: 8 additions & 4 deletions lib/screens/details_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ class _DetailsScreenState extends State<DetailsScreen> {
width: 60,
height: 60,
child: CircularProgressIndicator(
strokeWidth: 4.0,
color: Colors.black12,
strokeWidth: 2,
),
)),
);
Expand All @@ -115,7 +116,8 @@ class _DetailsScreenState extends State<DetailsScreen> {
width: 60,
height: 60,
child: CircularProgressIndicator(
strokeWidth: 4.0,
color: Colors.black12,
strokeWidth: 2,
),
)),
);
Expand All @@ -138,7 +140,8 @@ class _DetailsScreenState extends State<DetailsScreen> {
width: 60,
height: 60,
child: CircularProgressIndicator(
strokeWidth: 4.0,
color: Colors.black12,
strokeWidth: 2,
),
)),
);
Expand Down Expand Up @@ -171,7 +174,8 @@ class _DetailsScreenState extends State<DetailsScreen> {
width: 60,
height: 60,
child: CircularProgressIndicator(
strokeWidth: 4.0,
color: Colors.black12,
strokeWidth: 2,
),
)),
);
Expand Down
5 changes: 3 additions & 2 deletions lib/screens/fav_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class _FavScreenState extends State<FavScreen> {

late ScrollController _scrollController;

@override
@override
void initState() {
_scrollController = ScrollController();
super.initState();
Expand Down Expand Up @@ -108,7 +108,8 @@ class _FavScreenState extends State<FavScreen> {
width: 60,
height: 60,
child: CircularProgressIndicator(
strokeWidth: 4.0,
color: Colors.black12,
strokeWidth: 2,
),
)),
);
Expand Down
69 changes: 55 additions & 14 deletions lib/screens/font_details_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class _FontDetailsScreenState extends State<FontDetailsScreen>
Future<bool> onLikeTap(bool x) {
var storageController = Get.find<StorageController>();
if (isFav.value) {
storageController.removeFavorite(widget.font);
storageController.removeFavorite(widget.font);
} else {
storageController.addFavorite(widget.font);
}
Expand Down Expand Up @@ -82,14 +82,14 @@ class _FontDetailsScreenState extends State<FontDetailsScreen>
highlightElevation: 0,
shape: CircleBorder(side: BorderSide(color: Colors.black12, width: 1)),
child: Obx(() => Padding(
padding: const EdgeInsets.only(left: 3),
child: LikeButton(
padding: const EdgeInsets.only(left: 3),
child: LikeButton(
size: 20,
animationDuration: Duration(milliseconds: 500),
isLiked: isFav.value,
onTap: onLikeTap,
),
)),
)),
onPressed: () {},
),
body: SafeArea(
Expand All @@ -98,7 +98,9 @@ class _FontDetailsScreenState extends State<FontDetailsScreen>
child: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Padding(
padding: Responsive.isMobile(context) ? EdgeInsets.all(18.0) : EdgeInsets.all(40.0),
padding: Responsive.isMobile(context)
? EdgeInsets.all(18.0)
: EdgeInsets.all(40.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expand Down Expand Up @@ -171,7 +173,10 @@ class _FontDetailsScreenState extends State<FontDetailsScreen>
return Container(
height: 100,
width: 100,
child: Center(child: CircularProgressIndicator()),
child: Center(child: CircularProgressIndicator(
color: Colors.black12,
strokeWidth: 2,
)),
);
}),
SizedBox(height: 20),
Expand Down Expand Up @@ -209,10 +214,16 @@ class _FontDetailsScreenState extends State<FontDetailsScreen>
return Container(
height: 100,
width: 100,
child: Center(child: CircularProgressIndicator()),
child: Center(
child: CircularProgressIndicator(
color: Colors.black12,
strokeWidth: 2,
)),
);
}),
SizedBox(height: 50,)
SizedBox(
height: 50,
)
],
),
),
Expand Down Expand Up @@ -270,9 +281,24 @@ class GenImage extends StatelessWidget {
),
),
),
placeholder: (context, url) => SizedBox(
height: 100, child: Center(child: CircularProgressIndicator())),
errorWidget: (context, url, error) => Icon(Icons.error),
placeholder: (context, url) => Container(
decoration: BoxDecoration(
borderRadius: MyTheme.borderRadius,
border: Border.all(color: Colors.black12, width: 1)),
child: Center(
child: CircularProgressIndicator(
color: Colors.black12,
strokeWidth: 2,
))),
errorWidget: (context, url, error) => Container(
decoration: BoxDecoration(
borderRadius: MyTheme.borderRadius,
border: Border.all(color: Colors.black12, width: 1)),
child: Center(
child: Icon(
Icons.error,
color: Colors.black12,
))),
),
),
);
Expand Down Expand Up @@ -327,9 +353,24 @@ class GenImageCode extends StatelessWidget {
),
),
),
placeholder: (context, url) => SizedBox(
height: 100, child: Center(child: CircularProgressIndicator())),
errorWidget: (context, url, error) => Icon(Icons.error),
placeholder: (context, url) => Container(
decoration: BoxDecoration(
borderRadius: MyTheme.borderRadius,
border: Border.all(color: Colors.black12, width: 1)),
child: Center(
child: CircularProgressIndicator(
color: Colors.black12,
strokeWidth: 2,
))),
errorWidget: (context, url, error) => Container(
decoration: BoxDecoration(
borderRadius: MyTheme.borderRadius,
border: Border.all(color: Colors.black12, width: 1)),
child: Center(
child: Icon(
Icons.error,
color: Colors.black12,
))),
),
),
);
Expand Down
3 changes: 2 additions & 1 deletion lib/screens/search_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ class _SearchScreenState extends State<SearchScreen> {
width: 60,
height: 60,
child: CircularProgressIndicator(
strokeWidth: 4.0,
color: Colors.black12,
strokeWidth: 2,
),
)),
);
Expand Down
Loading

0 comments on commit 8740002

Please sign in to comment.