-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* redesign profile screens * added config for image cropper * use action button
- Loading branch information
1 parent
0e85483
commit 9386195
Showing
17 changed files
with
542 additions
and
384 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.
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
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,107 @@ | ||
import 'package:cached_network_image/cached_network_image.dart'; | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:flutter_svg/flutter_svg.dart'; | ||
import 'package:khelo/gen/assets.gen.dart'; | ||
import 'package:style/animations/on_tap_scale.dart'; | ||
import 'package:style/extensions/context_extensions.dart'; | ||
import 'package:style/indicator/progress_indicator.dart'; | ||
|
||
class ProfileImageAvatar extends StatelessWidget { | ||
final double size; | ||
final String? imageUrl; | ||
final String placeHolderImage; | ||
final bool isLoading; | ||
final Function() onEditButtonTap; | ||
|
||
const ProfileImageAvatar({ | ||
super.key, | ||
required this.size, | ||
this.imageUrl, | ||
required this.placeHolderImage, | ||
required this.isLoading, | ||
required this.onEditButtonTap, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Center( | ||
child: SizedBox( | ||
height: size, | ||
width: size, | ||
child: Stack( | ||
children: [ | ||
_roundedImageView(context), | ||
_editImageButton(context, onTap: onEditButtonTap) | ||
], | ||
), | ||
), | ||
); | ||
} | ||
|
||
Widget _roundedImageView(BuildContext context) { | ||
return Container( | ||
height: size, | ||
width: size, | ||
alignment: Alignment.center, | ||
decoration: BoxDecoration( | ||
shape: BoxShape.circle, | ||
image: imageUrl != null && !isLoading | ||
? DecorationImage( | ||
image: CachedNetworkImageProvider(imageUrl!), | ||
fit: BoxFit.cover) | ||
: null, | ||
color: context.colorScheme.primary), | ||
child: _imagePlaceHolder(context), | ||
); | ||
} | ||
|
||
Widget? _imagePlaceHolder(BuildContext context) { | ||
return imageUrl == null && !isLoading | ||
? SvgPicture.asset( | ||
Assets.images.icProfileThin, | ||
height: size / 2, | ||
width: size / 2, | ||
colorFilter: ColorFilter.mode( | ||
context.colorScheme.textInversePrimary, | ||
BlendMode.srcATop, | ||
), | ||
) | ||
: isLoading | ||
? AppProgressIndicator(color: context.colorScheme.surface) | ||
: null; | ||
} | ||
|
||
Widget _editImageButton( | ||
BuildContext context, { | ||
required Function() onTap, | ||
}) { | ||
return Align( | ||
alignment: Alignment.bottomRight, | ||
child: OnTapScale( | ||
onTap: onTap, | ||
child: Stack( | ||
alignment: Alignment.center, | ||
children: [ | ||
Container( | ||
height: 32, | ||
width: 32, | ||
decoration: BoxDecoration( | ||
color: context.colorScheme.surface, | ||
border: Border.all(color: context.colorScheme.textPrimary), | ||
shape: BoxShape.circle), | ||
), | ||
SvgPicture.asset( | ||
Assets.images.icEdit, | ||
height: 18, | ||
width: 18, | ||
colorFilter: ColorFilter.mode( | ||
context.colorScheme.textPrimary, | ||
BlendMode.srcATop, | ||
), | ||
) | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.