Skip to content

Commit

Permalink
Merge pull request #7 from muslimpack/new-shareable-image
Browse files Browse the repository at this point in the history
New shareable image
  • Loading branch information
7Eltantawy authored Dec 17, 2024
2 parents ae5d60a + 97a1c58 commit becf7d2
Show file tree
Hide file tree
Showing 34 changed files with 929 additions and 1,077 deletions.
4 changes: 2 additions & 2 deletions alazkar/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
distributionSha256Sum=97a52d145762adc241bad7fd18289bf7f6801e08ece6badf80402fe2b9f250b1
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip
distributionSha256Sum=f30b29580fe11719087d698da23f3b0f0d04031d8995f7dd8275a31f7674dc01
2 changes: 1 addition & 1 deletion alazkar/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pluginManagement {

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
id "com.android.application" version "8.1.0" apply false
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
}

Expand Down
Binary file added alazkar/assets/fonts/alhadari-medium.ttf
Binary file not shown.
Binary file added alazkar/assets/fonts/djadli_sarkha.ttf
Binary file not shown.
Binary file added alazkar/assets/images/grid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions alazkar/lib/src/core/di/dependency_injection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:alazkar/src/features/settings/data/repository/settings_storage.d
import 'package:alazkar/src/features/settings/data/repository/zikr_text_repo.dart';
import 'package:alazkar/src/features/settings/presentation/controller/cubit/settings_cubit.dart';
import 'package:alazkar/src/features/share_as_image/data/repository/share_image_repo.dart';
import 'package:alazkar/src/features/share_as_image/presentation/controller/share_as_image/share_as_image_bloc.dart';
import 'package:alazkar/src/features/share_as_image/presentation/controller/cubit/share_image_cubit.dart';
import 'package:alazkar/src/features/theme/domain/repository/theme_storage.dart';
import 'package:alazkar/src/features/theme/presentation/controller/cubit/theme_cubit.dart';
import 'package:alazkar/src/features/ui/data/repository/ui_repo.dart';
Expand Down Expand Up @@ -47,8 +47,8 @@ Future<void> initSL() async {
sl.registerLazySingleton(() => ZikrSourceFilterCubit(sl()));

/// Factory BLoC
sl.registerFactory(() => ShareAsImageBloc(sl()));
sl.registerFactory(
() => ZikrContentViewerBloc(sl(), sl(), sl()),
);
sl.registerFactory(() => ShareImageCubit(sl()));
}
5 changes: 5 additions & 0 deletions alazkar/lib/src/core/extension/extension_string.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ extension StringExtension on String {
);
}

String get removeTextInBrackets {
final RegExp regExp = RegExp(r'\(.*?\)');
return replaceAll(regExp, "");
}

String truncateText(int maxChars) {
if (length <= maxChars) {
return this;
Expand Down
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,
);
}
}

This file was deleted.

This file was deleted.

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,
),
);
}
}

This file was deleted.

Loading

0 comments on commit becf7d2

Please sign in to comment.