-
Notifications
You must be signed in to change notification settings - Fork 7
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 #7 from muslimpack/new-shareable-image
New shareable image
- Loading branch information
Showing
34 changed files
with
929 additions
and
1,077 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
Binary file not shown.
Binary file not shown.
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
51 changes: 51 additions & 0 deletions
51
alazkar/lib/src/features/share_as_image/data/models/shareable_image_card_settings.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,51 @@ | ||
// ignore_for_file: public_member_api_docs, sort_constructors_first | ||
|
||
import 'package:equatable/equatable.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class ShareableImageCardSettings extends Equatable { | ||
///Image size | ||
final Size imageSize; | ||
final int wordsCountPerSize; | ||
|
||
///Text style | ||
final String mainFontFamily; | ||
final String secondaryFontFamily; | ||
|
||
const ShareableImageCardSettings({ | ||
required this.imageSize, | ||
required this.wordsCountPerSize, | ||
required this.mainFontFamily, | ||
required this.secondaryFontFamily, | ||
}); | ||
|
||
const ShareableImageCardSettings.defaultSettings() | ||
: this( | ||
imageSize: const Size(1080, 1080), | ||
wordsCountPerSize: 1500, | ||
mainFontFamily: "kitab", | ||
secondaryFontFamily: "kitab", | ||
); | ||
|
||
@override | ||
List<Object> get props => [ | ||
imageSize, | ||
wordsCountPerSize, | ||
mainFontFamily, | ||
secondaryFontFamily, | ||
]; | ||
|
||
ShareableImageCardSettings copyWith({ | ||
Size? imageSize, | ||
int? wordsCountPerSize, | ||
String? mainFontFamily, | ||
String? secondaryFontFamily, | ||
}) { | ||
return ShareableImageCardSettings( | ||
imageSize: imageSize ?? this.imageSize, | ||
wordsCountPerSize: wordsCountPerSize ?? this.wordsCountPerSize, | ||
mainFontFamily: mainFontFamily ?? this.mainFontFamily, | ||
secondaryFontFamily: secondaryFontFamily ?? this.secondaryFontFamily, | ||
); | ||
} | ||
} |
52 changes: 0 additions & 52 deletions
52
alazkar/lib/src/features/share_as_image/presentation/components/app_bar.dart
This file was deleted.
Oops, something went wrong.
86 changes: 0 additions & 86 deletions
86
alazkar/lib/src/features/share_as_image/presentation/components/color_swatch_builder.dart
This file was deleted.
Oops, something went wrong.
77 changes: 77 additions & 0 deletions
77
alazkar/lib/src/features/share_as_image/presentation/components/dot_bar.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,77 @@ | ||
import 'package:alazkar/src/core/extension/extension_color.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class DotBar extends StatelessWidget { | ||
final int length; | ||
final int activeIndex; | ||
final Color? dotColor; | ||
final bool showNumber; | ||
const DotBar({ | ||
super.key, | ||
required this.length, | ||
required this.activeIndex, | ||
this.dotColor, | ||
this.showNumber = false, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Wrap( | ||
alignment: WrapAlignment.center, | ||
children: List.generate( | ||
length, | ||
(index) => Dot( | ||
index: index, | ||
isActive: index == activeIndex, | ||
color: dotColor, | ||
showNumber: showNumber, | ||
), | ||
), | ||
); | ||
} | ||
} | ||
|
||
class Dot extends StatelessWidget { | ||
final int index; | ||
final bool isActive; | ||
final bool showNumber; | ||
final Color? color; | ||
const Dot({ | ||
super.key, | ||
required this.index, | ||
required this.isActive, | ||
required this.showNumber, | ||
this.color, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final Color dotColor = color ?? Theme.of(context).colorScheme.primary; | ||
|
||
if (showNumber) { | ||
return Padding( | ||
padding: const EdgeInsets.symmetric(horizontal: 5), | ||
child: CircleAvatar( | ||
backgroundColor: dotColor, | ||
child: Text( | ||
"${index + 1}", | ||
style: TextStyle( | ||
fontWeight: isActive ? FontWeight.bold : FontWeight.normal, | ||
color: dotColor.getContrastColor, | ||
), | ||
), | ||
), | ||
); | ||
} | ||
return AnimatedContainer( | ||
duration: const Duration(milliseconds: 200), | ||
height: 10, | ||
width: isActive ? 25 : 10, | ||
margin: const EdgeInsets.all(5), | ||
decoration: BoxDecoration( | ||
borderRadius: BorderRadius.circular(20), | ||
color: dotColor, | ||
), | ||
); | ||
} | ||
} |
71 changes: 0 additions & 71 deletions
71
alazkar/lib/src/features/share_as_image/presentation/components/image_body.dart
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.