Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flutter 3.10.5 and fixed TextSticker behaviour #39

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
4 changes: 2 additions & 2 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ apply plugin: 'kotlin-kapt'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 31
compileSdkVersion 33

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -37,7 +37,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.example"
minSdkVersion 21
targetSdkVersion 31
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand Down
15 changes: 12 additions & 3 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.example">

<application
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/>
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION"/>

<application
android:label="example"
android:icon="@mipmap/ic_launcher"
android:requestLegacyExternalStorage="true">
android:requestLegacyExternalStorage="false">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:exported="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
Expand Down
4 changes: 2 additions & 2 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.5.21'
ext.kotlin_version = '1.7.10'
repositories {
google()
jcenter()
Expand All @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
13 changes: 10 additions & 3 deletions example/lib/collapsable_gallery.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:drishya_picker/drishya_picker.dart';
import 'package:example/text_delegates/italian_drishya_text_delegate.dart';
import 'package:example/fullscreen_gallery.dart';
import 'package:example/recent_entities.dart';
import 'package:example/shape_icons.dart';
Expand Down Expand Up @@ -39,6 +40,7 @@ class _CollapsableGalleryState extends State<CollapsableGallery> {
@override
Widget build(BuildContext context) {
return SlidableGallery(
//textDelegate: CustomDrishyaTextDelegate(),
controller: _controller,
child: Scaffold(
appBar: AppBar(
Expand Down Expand Up @@ -193,15 +195,15 @@ const _colors = [
];

///
final _stickers1 = {'ARTS': _arts, 'EMOJIS': _gifs, 'SHAPES': _shapes};
final _stickers2 = {'EMOJIS': _gifs, 'SHAPES': _shapes};
final _stickers1 = {'ARTS': _arts,'EMOJI':_emojis, 'EMOJIS': _gifs, 'SHAPES': _shapes};
final _stickers2 = {'EMOJIS': _gifs,'EMOJI':_emojis, 'SHAPES': _shapes};
final _stickers3 = {
'SHAPES': _shapes,
'SHAPES1': _shapes,
'SHAPES2': _shapes,
'SHAPES3': _shapes,
'SHAPES4': _shapes,
'SHAPES5': _shapes,
'SHAPES5': _shapes,'EMOJI':_emojis,
};

///
Expand Down Expand Up @@ -352,3 +354,8 @@ final _shapes = ShapeIcons.values
(iconData) => IconSticker(iconData: iconData),
)
.toSet();
final _emojis = Emojis.values
.map(
(iconData) => TextSticker(text: iconData,),
)
.toSet();
6 changes: 5 additions & 1 deletion example/lib/fullscreen_gallery.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:drishya_picker/drishya_picker.dart';
import 'package:example/collapsable_gallery.dart';
import 'package:example/text_delegates/italian_drishya_text_delegate.dart';
import 'package:example/grid_view_widget.dart';
import 'package:example/recent_entities.dart';
import 'package:example/text_field_view.dart';
Expand All @@ -19,7 +20,7 @@ class FullscreenGallery extends StatefulWidget {
class _FullscreenGalleryState extends State<FullscreenGallery> {
late final GalleryController _controller;
late final ValueNotifier<Data> _notifier;

final ItalianDrishyaTextDelegate textDelegate=ItalianDrishyaTextDelegate();
@override
void initState() {
super.initState();
Expand All @@ -36,6 +37,7 @@ class _FullscreenGalleryState extends State<FullscreenGallery> {

@override
Widget build(BuildContext context) {
print(textDelegate.hashCode);
return Scaffold(
appBar: AppBar(
title: const Text('Fullscreen Gallery'),
Expand Down Expand Up @@ -79,6 +81,7 @@ class _FullscreenGalleryState extends State<FullscreenGallery> {
Padding(
padding: const EdgeInsets.all(8.0),
child: CameraViewField(
textDelegate: textDelegate,
editorSetting: gallerySetting.editorSetting,
onCapture: (entities) {
_notifier.value = _notifier.value.copyWith(
Expand All @@ -94,6 +97,7 @@ class _FullscreenGalleryState extends State<FullscreenGallery> {
valueListenable: _notifier,
builder: (context, data, child) {
return GalleryViewField(
textDelegate: textDelegate,
setting: gallerySetting.copyWith(
maximumCount: data.maxLimit,
albumSubtitle: 'Image only',
Expand Down
2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class MyApp extends StatelessWidget {
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
primarySwatch: Colors.green,
),
home: _Home(),
);
Expand Down
70 changes: 70 additions & 0 deletions example/lib/shape_icons.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,73 @@ class ShapeIcons {
heart,
];
}

class Emojis {
Emojis._();

///
static const values = <String>[
'😄',
'🥹',
'😂',
'😍',
'🥰',
'😊',
'😋',
'🤓',
'😎',
'🤩',
'😩',
'🥺',
'😭',
'😤',
'😡',
'🤬',
'😱',
'🤗',
'😐',
'🙄',
'🥱',
'😴',
'🤕',
'💩',
'🫶',
'👍',
'💪',
'🐶',
'🐱',
'🐭',
'🐹',
'🐰',
'🦊',
'🐻',
'🐼',
'🐻',

'🐨',
'🐯',
'🦁',
'🐮',
'🐷',
'🐽',
'🐸',
'🐵',
'🙈',
'🙉',
'🐔',
'🐧',
'🐦',
'🐤',
'🐣',
'🐥',
'🦆',
'🔥',
'⭐',
'🌝',
'🌞',
'🌻',
'🌊',
'💧',
'💦','❄',
];
}
143 changes: 143 additions & 0 deletions example/lib/text_delegates/italian_drishya_text_delegate.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
import 'package:drishya_picker/drishya_picker.dart';

class ItalianDrishyaTextDelegate implements DrishyaTextDelegate{
@override
String get accessYour => 'Permetti l\'accesso a';

@override
String get album => 'Album';

@override
String get albumForMedia => 'galleria per le foto';

@override
String get allPhotos => 'Foto';

@override
String get allowAccess => 'Accetta';

@override
String get allowPermission => 'Concedi il permesso per ';

@override
String get areYouSureDiscard => 'Sicuro di voler scartare?';

@override
String get backUndo => 'Torna indietro';

@override
String get camera => 'Fotocamera';

@override
String get cameraAndMicrophone => 'fotocamera e microfono';

@override
String get cameraView => 'CameraView';

@override
String get cancel => 'ANNULLA';

@override
String get couldntFindCamera => 'Errore nel caricamento della fotocamera';

@override
String get denyAccess => 'RIFIUTA';

@override
String get discard => 'SCARTA';

@override
String get discardChanges => 'Scarta le tue modifiche';

@override
String get done => 'FATTO';

@override
String get edit => 'MODIFICA';

@override
String get failedLoadBackground => 'Impossibile caricare lo sfondo';

@override
String get gallery => 'Galleria';

@override
String get galleryView => 'GalleryView';

@override
String maximumSelection(int value) =>'Il limite massimo di selezione '
'$value è stato raggiunto!';

@override
String get no => 'NO';

@override
String get noAlbums => 'Nessun album';

@override
String get noAlbumsAvailable => 'Nessun album disponibile';

@override
String get noMediaAvailable => 'Nessun media disponibile';

@override
String get normal => 'Normale';

@override
String get select => 'SELEZIONA';

@override
String get selectMedia => 'Seleziona media';

@override
String get selfie => 'Selfie';

@override
String get simulator => 'Simulatore';

@override
String get somethingWrong => 'C\'è stato un errore. Riprova più tardi';

@override
String get stickersNotAvailable => 'Stickers non disponibili al momento';

@override
String get tapToType => 'Tocca per scrivere';

@override
String get text => 'Testo';

@override
String get unavailable => 'Non disponibile';

@override
String get unknown => 'Sconosciuto';

@override
String get unselectItems => 'Deseleziona elementi';

@override
String get unselectTheseItems => 'Deseleziona questi elementi';

@override
String get unsupportedBackground => 'Sfondo non supportato';

@override
String get video => 'Video';

@override
String typeLabel(int value) {
switch (value) {
case 0:
return text;
case 1:
return normal;
case 2:
return video;
case 4:
return selfie;
}
return unknown;
}

}
Loading