Skip to content

Commit

Permalink
latest fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dreampowder committed Dec 9, 2022
1 parent 9b3081d commit dd0fdb0
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 80 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [0.1.2] 19.09.2022

* Fixed a bug where it was impossible to delete text content or text content reappears after deletion
* Added stream subscription into didUpdateWidget controller. [thanks @sipanpetrosyan]

## [0.1.1] 13.09.2022

* Added emoji detection support [thanks @moazh]
Expand Down
2 changes: 1 addition & 1 deletion example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>9.0</string>
<string>11.0</string>
</dict>
</plist>
6 changes: 3 additions & 3 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -346,7 +346,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -395,7 +395,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
2 changes: 2 additions & 0 deletions example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,7 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
</dict>
</plist>
9 changes: 3 additions & 6 deletions example/lib/default_controller_above.example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class _DefaultControllerAboveExampleScreenState extends State<DefaultControllerA
decoration: InputDecoration(
hintText: "Type your message",
// border: OutlineInputBorder()
suffix: IconButton(icon: Icon(Icons.send),onPressed: (){},)
),
),
),
Expand Down Expand Up @@ -117,9 +118,7 @@ class _DefaultControllerAboveExampleScreenState extends State<DefaultControllerA
ListTile(
title: Text("@user_$index"),
onTap: (){
if(lastDetection != null){
_textEditingController.replaceRange("@user_$index", lastDetection.range);
}
_textEditingController.replaceRange("@user_$index", lastDetection.range);
},
)),
),
Expand All @@ -140,9 +139,7 @@ class _DefaultControllerAboveExampleScreenState extends State<DefaultControllerA
ListTile(
title: Text("#hashtag_$index"),
onTap: (){
if(lastDetection != null){
_textEditingController.replaceRange("#hashtag_$index", lastDetection.range);
}
_textEditingController.replaceRange("#hashtag_$index", lastDetection.range);
},
)),
),
Expand Down
8 changes: 2 additions & 6 deletions example/lib/default_controller_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ class _DefaultControllerExampleScreenState extends State<DefaultControllerExampl
ListTile(
title: Text("@user_$index"),
onTap: (){
if(lastDetection != null){
_textEditingController.replaceRange("@user_$index", lastDetection.range);
}
_textEditingController.replaceRange("@user_$index", lastDetection.range);
},
)),
preferredSize: Size.fromHeight(height),);
Expand All @@ -107,9 +105,7 @@ class _DefaultControllerExampleScreenState extends State<DefaultControllerExampl
ListTile(
title: Text("#hashtag_$index"),
onTap: (){
if(lastDetection != null){
_textEditingController.replaceRange("#hashtag_$index", lastDetection.range);
}
_textEditingController.replaceRange("#hashtag_$index", lastDetection.range);
},
)),
preferredSize: Size.fromHeight(height),);
Expand Down
51 changes: 22 additions & 29 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.2"
version: "2.9.0"
boolean_selector:
dependency: transitive
description:
Expand All @@ -21,28 +21,21 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
version: "1.2.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
version: "1.16.0"
cupertino_icons:
dependency: "direct main"
description:
Expand All @@ -56,7 +49,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.3.1"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -68,7 +61,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.0.9"
version: "0.1.1"
flutter_test:
dependency: "direct dev"
description: flutter
Expand All @@ -80,21 +73,28 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.11"
version: "0.12.12"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
version: "1.8.2"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -113,7 +113,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.9.0"
stack_trace:
dependency: transitive
description:
Expand All @@ -134,35 +134,28 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.3"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "0.4.12"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
version: "2.1.2"
sdks:
dart: ">=2.14.0 <3.0.0"
dart: ">=2.17.0-0 <3.0.0"
flutter: ">=1.17.0"
6 changes: 3 additions & 3 deletions lib/controller/social_text_editing_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ class SocialTextEditingController extends TextEditingController{
if(currentPosition == -1){
currentPosition = 0;
}

if(currentPosition >newValue.text.length){
currentPosition = newValue.text.length - 1;
}
var subString = newValue.text.substring(0,currentPosition);

var lastPart = subString.split(" ").last.split("\n").last;
Expand Down Expand Up @@ -105,6 +107,4 @@ class SocialTextEditingController extends TextEditingController{
TextSpan buildTextSpan({required BuildContext context, TextStyle? style, required bool withComposing}) {
return SocialTextSpanBuilder(regularExpressions: _regularExpressions,defaultTextStyle: style,detectionTextStyles: detectionTextStyles).build(text);
}


}
10 changes: 7 additions & 3 deletions lib/widget/social_text_field_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,12 @@ class _DefaultSocialTextFieldControllerState
@override
void didUpdateWidget(covariant DefaultSocialTextFieldController oldWidget) {
super.didUpdateWidget(oldWidget);
_streamSubscription =
widget.textEditingController.subscribeToDetection(onDetectContent);
_subscribeToStreamIfNeeded();
}

void _subscribeToStreamIfNeeded() async{
await _streamSubscription?.cancel();
_streamSubscription = widget.textEditingController.subscribeToDetection(onDetectContent);
}

///Shows the widget that hes been set with the [widget.detectionBuilders]. return empty Container if noting found
Expand Down Expand Up @@ -147,7 +151,7 @@ class _DefaultSocialTextFieldControllerState
if (!(renderObject is RenderBox)) {
return 0.0;
}
RenderBox box = renderObject as RenderBox;
RenderBox box = renderObject;
Offset position = box.localToGlobal(Offset.zero); //this is global position
double y = position.dy; //
return MediaQuery.of(context).size.height - y;
Expand Down
Loading

0 comments on commit dd0fdb0

Please sign in to comment.