├── .gitignore ├── .metadata ├── .vscode └── settings.json ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── android ├── .gitignore ├── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src │ ├── main │ ├── AndroidManifest.xml │ └── kotlin │ │ └── com │ │ └── developerjamiu │ │ └── smart_text_flutter │ │ ├── Entities.kt │ │ ├── SmartTextFlutterPlugin.kt │ │ └── TextClassifier.kt │ └── test │ └── kotlin │ └── com │ └── developerjamiu │ └── smart_text_flutter │ └── SmartTextFlutterPluginTest.kt ├── example ├── .gitignore ├── README.md ├── analysis_options.yaml ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── developerjamiu │ │ │ │ │ └── smart_text_flutter_example │ │ │ │ │ └── MainActivity.kt │ │ │ └── res │ │ │ │ ├── drawable-v21 │ │ │ │ └── launch_background.xml │ │ │ │ ├── drawable │ │ │ │ └── launch_background.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── values-night │ │ │ │ └── styles.xml │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Podfile │ ├── Podfile.lock │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ ├── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ │ └── LaunchImage.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ └── README.md │ │ ├── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── Runner-Bridging-Header.h │ └── RunnerTests │ │ └── RunnerTests.swift ├── lib │ ├── main.dart │ └── smart_text.dart ├── pubspec.lock ├── pubspec.yaml └── test │ └── widget_test.dart ├── ios ├── .gitignore ├── Assets │ └── .gitkeep ├── Classes │ ├── NSDataDetectorExtension.swift │ ├── SmartTextFlutterPlugin.swift │ └── TextClassifier.swift └── smart_text_flutter.podspec ├── lib ├── smart_text_flutter.dart └── src │ ├── extensions │ ├── item_span_default_config.dart │ └── string.dart │ ├── models │ ├── item_span.dart │ └── item_span_config.dart │ ├── smart_text_flutter.dart │ ├── smart_text_flutter_method_channel.dart │ ├── smart_text_flutter_platform_interface.dart │ └── widgets │ ├── smart_selectable_text.dart │ └── smart_text.dart ├── pubspec.yaml └── test └── src └── smart_text_flutter_method_channel_test.dart /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 26 | /pubspec.lock 27 | **/doc/api/ 28 | .dart_tool/ 29 | build/ 30 | 31 | # FVM Version Cache 32 | .fvm/ -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: "67457e669f79e9f8d13d7a68fe09775fefbb79f4" 8 | channel: "stable" 9 | 10 | project_type: plugin 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 17 | base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 18 | - platform: android 19 | create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 20 | base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 21 | - platform: ios 22 | create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 23 | base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 24 | 25 | # User provided section 26 | 27 | # List of Local paths (relative to this file) that should be 28 | # ignored by the migrate tool. 29 | # 30 | # Files that are not part of the templates will be ignored by default. 31 | unmanaged_files: 32 | - 'lib/main.dart' 33 | - 'ios/Runner.xcodeproj/project.pbxproj' 34 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "dart.flutterSdkPath": ".fvm/versions/3.27.1" 3 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.3.5 2 | 3 | ### Added 4 | 5 | - Fix app crash when text starting with emoji is entered 6 | 7 | ## 0.3.4 8 | 9 | ### Added 10 | 11 | - Fix url not launching 12 | 13 | ## 0.3.3 14 | 15 | ### Added 16 | 17 | - Fix trailing protocol issue in urls on Android 18 | - Bump url launcher version on iOS 19 | 20 | ## 0.3.2 21 | 22 | ### Added 23 | 24 | - Add ability to humanize url 25 | - Fix new line parsing issue on iOS 26 | 27 | ## 0.3.1 28 | 29 | ### Added 30 | 31 | - Export smart selectable text 32 | 33 | ## 0.3.0 34 | 35 | ### Added 36 | 37 | - Add smart selectable text 38 | 39 | ## 0.2.2 40 | 41 | ### Added 42 | 43 | - Include all the properties of the flutter's Text widget in the SmartText widget 44 | 45 | ## 0.2.1 46 | 47 | ### Added 48 | 49 | - Update documentation 50 | 51 | ## 0.2.0 52 | 53 | ### Added 54 | 55 | - Added the SmartText widget which automatically detects links in text 56 | 57 | ## 0.1.0 58 | 59 | ### Added 60 | 61 | - Used [Linkify](https://developer.android.com/reference/android/text/util/Linkify) for Android API 8.1 (API 27) and below 62 | - Added support for older Android versions 63 | 64 | ## 0.0.1 65 | 66 | ### Added 67 | 68 | - Added a method `classifyText` that parses text in a sequence of texts and links 69 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2024 Jamiu Okanlawon 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Smart Text Flutter 2 | 3 | A Flutter plugin used to find links in plain texts. 4 | 5 | | | Android | iOS | 6 | | ----------- | ------- | ----- | 7 | | **Support** | SDK 19+ | 11.0+ | 8 | 9 | It uses [NSDataDetector](https://developer.apple.com/documentation/foundation/nsdatadetector) for iOS and [TextClassifier](https://developer.android.com/reference/android/view/textclassifier/TextClassifier) for Android. 10 | 11 | **Texts (links) can be among these 6 types** 12 | 13 | ```Dart 14 | enum ItemSpanType { address, phone, email, datetime, url, text } 15 | ``` 16 | 17 | ## Usage 18 | 19 | To use this plugin, add `smart_text_flutter` as a [dependency in your pubspec.yaml file](https://flutter.dev/platform-plugins/). 20 | 21 | **Example** 22 | 23 | ```Dart 24 | class SmartTextFlutterExample extends StatelessWidget { 25 | const SmartTextFlutterExample({super.key}); 26 | 27 | @override 28 | Widget build(BuildContext context) { 29 | const text = 30 | 'Here is a text with an address: 36 Lagos Street written at 9 PM by someone with phone: +2340000000000 and you can reach him at reaching@email.com or you can check twitter.com'; 31 | 32 | return MaterialApp( 33 | home: Scaffold( 34 | appBar: AppBar( 35 | title: const Text('Smart Text Flutter'), 36 | ), 37 | body: const Center( 38 | child: SmartText(text), 39 | ), 40 | ), 41 | ); 42 | } 43 | } 44 | ``` 45 | 46 | **Demo** 47 | 48 | ![ScreenRecording2024-03-12at17 38 55-ezgif com-resize](https://github.com/developerjamiu/smart-text-flutter/assets/50176100/dfb4f68e-77d3-4acc-9e07-a27239aa519b) 49 | 50 | ## Notes 51 | 52 | - DateTime is not supported on Android 53 | - Address is not supported on Android 8.1 (API 27) and below 54 | - There is no default implementation for when DateTime is clicked (the formatted date returned in the callback in case) 55 | 56 | ## Properties 57 | 58 | ```Dart 59 | /// The text to linkify 60 | /// This text will be classified and the links will be highlighted 61 | final String text; 62 | 63 | /// The configuration for setting the [TextStyle] and onClicked method 64 | /// This affects the whole text 65 | final ItemSpanConfig? config; 66 | 67 | /// The configuration for setting the [TextStyle] and what happens when the address link is clicked 68 | final ItemSpanConfig? addressConfig; 69 | 70 | /// The configuration for setting the [TextStyle] and what happens when the phone link is clicked 71 | final ItemSpanConfig? phoneConfig; 72 | 73 | /// The configuration for setting the [TextStyle] and what happens when the url is clicked 74 | final ItemSpanConfig? urlConfig; 75 | 76 | /// The configuration for setting the [TextStyle] and what happens when the date time is clicked 77 | final ItemSpanConfig? dateTimeConfig; 78 | 79 | /// The configuration for setting the [TextStyle] and what happens when the email link is clicked 80 | final ItemSpanConfig? emailConfig; 81 | 82 | /// By default, URLs in the text (e.g., starting with http:// or https://) are displayed as-is. 83 | /// Set humanize to true to remove the protocol (e.g., http:// or https://). 84 | final bool humanize; 85 | 86 | /// Other properties have the same usage as the Flutter text widget 87 | final StrutStyle? strutStyle; 88 | 89 | final TextAlign? textAlign; 90 | 91 | final TextDirection? textDirection; 92 | 93 | final Locale? locale; 94 | 95 | final bool? softWrap; 96 | 97 | final TextOverflow? overflow; 98 | 99 | final TextScaler? textScaler; 100 | 101 | final int? maxLines; 102 | 103 | final String? semanticsLabel; 104 | 105 | final TextWidthBasis? textWidthBasis; 106 | 107 | final ui.TextHeightBehavior? textHeightBehavior; 108 | 109 | final Color? selectionColor; 110 | ``` 111 | 112 | **ItemSpanConfig** 113 | 114 | ```Dart 115 | /// The [TextStyle] if the link 116 | final TextStyle? textStyle; 117 | 118 | /// The method called when a link is clicked 119 | /// When the is set, the implementation will override the default 120 | /// implementation 121 | final void Function(String data)? onClicked; 122 | ``` 123 | 124 | **The smart text widget example** 125 | 126 | ```Dart 127 | SmartText( 128 | text, 129 | config: const ItemSpanConfig( 130 | textStyle: TextStyle(), 131 | ), 132 | addressConfig: ItemSpanConfig( 133 | textStyle: const TextStyle(), 134 | onClicked: (_) {}, 135 | ), 136 | emailConfig: ItemSpanConfig( 137 | textStyle: const TextStyle(), 138 | onClicked: (_) {}, 139 | ), 140 | phoneConfig: ItemSpanConfig( 141 | textStyle: const TextStyle(), 142 | onClicked: (_) {}, 143 | ), 144 | urlConfig: ItemSpanConfig( 145 | textStyle: const TextStyle(), 146 | onClicked: (_) {}, 147 | ), 148 | dateTimeConfig: ItemSpanConfig( 149 | textStyle: const TextStyle(), 150 | onClicked: (_) {}, 151 | ), 152 | ) 153 | ``` 154 | 155 | **Code from the example folder.** 156 | 157 | ```Dart 158 | class SmartTextFlutterExample extends StatefulWidget { 159 | const SmartTextFlutterExample({super.key}); 160 | 161 | @override 162 | State createState() => 163 | _SmartTextFlutterExampleState(); 164 | } 165 | 166 | class _SmartTextFlutterExampleState extends State { 167 | final List messageTexts = []; 168 | 169 | late final _messageController = TextEditingController(); 170 | 171 | @override 172 | void dispose() { 173 | _messageController.dispose(); 174 | super.dispose(); 175 | } 176 | 177 | @override 178 | Widget build(BuildContext context) { 179 | return MaterialApp( 180 | debugShowCheckedModeBanner: false, 181 | home: Scaffold( 182 | appBar: AppBar( 183 | title: const Text('Smart Text Flutter'), 184 | ), 185 | body: Column( 186 | children: [ 187 | Expanded( 188 | child: ListView.builder( 189 | itemCount: messageTexts.length, 190 | itemBuilder: (context, index) => Align( 191 | alignment: Alignment.centerLeft, 192 | child: Container( 193 | constraints: BoxConstraints( 194 | maxWidth: MediaQuery.sizeOf(context).width * 0.8, 195 | ), 196 | decoration: BoxDecoration( 197 | borderRadius: BorderRadius.circular(16), 198 | color: Colors.blueGrey.shade50, 199 | ), 200 | padding: const EdgeInsets.all(8), 201 | margin: const EdgeInsets.all(8), 202 | child: SmartText( 203 | messageTexts[index], 204 | ), 205 | ), 206 | ), 207 | ), 208 | ), 209 | Padding( 210 | padding: const EdgeInsets.all(8.0), 211 | child: Row( 212 | children: [ 213 | Expanded( 214 | child: TextField( 215 | controller: _messageController, 216 | decoration: const InputDecoration( 217 | hintText: 'Enter text', 218 | contentPadding: EdgeInsets.all(8), 219 | border: OutlineInputBorder(), 220 | ), 221 | ), 222 | ), 223 | const SizedBox(width: 8), 224 | ElevatedButton( 225 | onPressed: () { 226 | setState(() => messageTexts.add(_messageController.text)); 227 | _messageController.clear(); 228 | }, 229 | child: const Text('Send Message'), 230 | ), 231 | ], 232 | ), 233 | ), 234 | const SizedBox(height: 40), 235 | ], 236 | ), 237 | ), 238 | ); 239 | } 240 | } 241 | ``` 242 | 243 | ## Bugs/Requests 244 | 245 | If you encounter any problems feel free to open an issue [here](https://github.com/developerjamiu/smart-text-flutter/issues). If you feel the library is missing a feature, please raise a ticket on GitHub and I'll look into it. Pull requests are also welcome. 246 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | # Additional information about this file can be found at 4 | # https://dart.dev/guides/language/analysis-options 5 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .cxx 10 | tmplibs 11 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | group 'com.developerjamiu.smart_text_flutter' 2 | version '1.0-SNAPSHOT' 3 | 4 | buildscript { 5 | ext.kotlin_version = '1.7.10' 6 | repositories { 7 | google() 8 | mavenCentral() 9 | } 10 | 11 | dependencies { 12 | classpath 'com.android.tools.build:gradle:7.3.1' 13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | mavenCentral() 21 | } 22 | } 23 | 24 | apply plugin: 'com.android.library' 25 | apply plugin: 'kotlin-android' 26 | 27 | android { 28 | if (project.android.hasProperty("namespace")) { 29 | namespace 'com.developerjamiu.smart_text_flutter' 30 | } 31 | 32 | compileSdkVersion 33 33 | 34 | compileOptions { 35 | sourceCompatibility JavaVersion.VERSION_1_8 36 | targetCompatibility JavaVersion.VERSION_1_8 37 | } 38 | 39 | kotlinOptions { 40 | jvmTarget = '1.8' 41 | } 42 | 43 | sourceSets { 44 | main.java.srcDirs += 'src/main/kotlin' 45 | test.java.srcDirs += 'src/test/kotlin' 46 | } 47 | 48 | defaultConfig { 49 | minSdkVersion 19 50 | } 51 | 52 | dependencies { 53 | testImplementation 'org.jetbrains.kotlin:kotlin-test' 54 | testImplementation 'org.mockito:mockito-core:5.0.0' 55 | } 56 | 57 | testOptions { 58 | unitTests.all { 59 | useJUnitPlatform() 60 | 61 | testLogging { 62 | events "passed", "skipped", "failed", "standardOut", "standardError" 63 | outputs.upToDateWhen { false } 64 | showStandardStreams = true 65 | } 66 | } 67 | } 68 | } 69 | 70 | dependencies { 71 | implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3") 72 | // implementation files('tmplibs/flutter.jar') 73 | } 74 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developerjamiu/smart-text-flutter/2c7cd02d349020edd354377c7223ccd54e1d424a/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /android/gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 84 | 85 | APP_NAME="Gradle" 86 | APP_BASE_NAME=${0##*/} 87 | 88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | 142 | # Increase the maximum file descriptors if we can. 143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 144 | case $MAX_FD in #( 145 | max*) 146 | MAX_FD=$( ulimit -H -n ) || 147 | warn "Could not query maximum file descriptor limit" 148 | esac 149 | case $MAX_FD in #( 150 | '' | soft) :;; #( 151 | *) 152 | ulimit -n "$MAX_FD" || 153 | warn "Could not set maximum file descriptor limit to $MAX_FD" 154 | esac 155 | fi 156 | 157 | # Collect all arguments for the java command, stacking in reverse order: 158 | # * args from the command line 159 | # * the main class name 160 | # * -classpath 161 | # * -D...appname settings 162 | # * --module-path (only if needed) 163 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 164 | 165 | # For Cygwin or MSYS, switch paths to Windows format before running java 166 | if "$cygwin" || "$msys" ; then 167 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 168 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 169 | 170 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 171 | 172 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 173 | for arg do 174 | if 175 | case $arg in #( 176 | -*) false ;; # don't mess with options #( 177 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 178 | [ -e "$t" ] ;; #( 179 | *) false ;; 180 | esac 181 | then 182 | arg=$( cygpath --path --ignore --mixed "$arg" ) 183 | fi 184 | # Roll the args list around exactly as many times as the number of 185 | # args, so each arg winds up back in the position where it started, but 186 | # possibly modified. 187 | # 188 | # NB: a `for` loop captures its iteration list before it begins, so 189 | # changing the positional parameters here affects neither the number of 190 | # iterations, nor the values presented in `arg`. 191 | shift # remove old arg 192 | set -- "$@" "$arg" # push replacement arg 193 | done 194 | fi 195 | 196 | # Collect all arguments for the java command; 197 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of 198 | # shell script including quotes and variable substitutions, so put them in 199 | # double quotes to make sure that they get re-expanded; and 200 | # * put everything else in single quotes, so that it's not re-expanded. 201 | 202 | set -- \ 203 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 204 | -classpath "$CLASSPATH" \ 205 | org.gradle.wrapper.GradleWrapperMain \ 206 | "$@" 207 | 208 | # Use "xargs" to parse quoted args. 209 | # 210 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 211 | # 212 | # In Bash we could simply go: 213 | # 214 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 215 | # set -- "${ARGS[@]}" "$@" 216 | # 217 | # but POSIX shell has neither arrays nor command substitution, so instead we 218 | # post-process each arg (as a line of input to sed) to backslash-escape any 219 | # character that might be a shell metacharacter, then use eval to reverse 220 | # that process (while maintaining the separation between arguments), and wrap 221 | # the whole thing up as a single "set" statement. 222 | # 223 | # This will of course break if any of these variables contains a newline or 224 | # an unmatched quote. 225 | # 226 | 227 | eval "set -- $( 228 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 229 | xargs -n1 | 230 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 231 | tr '\n' ' ' 232 | )" '"$@"' 233 | 234 | exec "$JAVACMD" "$@" 235 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'smart_text_flutter' 2 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /android/src/main/kotlin/com/developerjamiu/smart_text_flutter/Entities.kt: -------------------------------------------------------------------------------- 1 | package com.developerjamiu.smart_text_flutter 2 | 3 | data class LinkResult(val start: Int, val end: Int, val type: String) 4 | 5 | data class ItemSpan(val text: String, val type: String, val rawValue: String) { 6 | fun toMap(): Map { 7 | return mapOf( 8 | "text" to text, 9 | "type" to type, 10 | "rawValue" to rawValue, 11 | ) 12 | } 13 | } -------------------------------------------------------------------------------- /android/src/main/kotlin/com/developerjamiu/smart_text_flutter/SmartTextFlutterPlugin.kt: -------------------------------------------------------------------------------- 1 | package com.developerjamiu.smart_text_flutter 2 | 3 | import android.annotation.TargetApi 4 | import android.app.Activity 5 | import android.content.Context 6 | import android.os.Build 7 | import android.view.textclassifier.TextClassificationManager 8 | import io.flutter.embedding.android.FlutterActivity 9 | import io.flutter.embedding.engine.plugins.FlutterPlugin 10 | import io.flutter.embedding.engine.plugins.activity.ActivityAware 11 | import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding 12 | import io.flutter.plugin.common.MethodCall 13 | import io.flutter.plugin.common.MethodChannel 14 | import io.flutter.plugin.common.MethodChannel.MethodCallHandler 15 | import io.flutter.plugin.common.MethodChannel.Result 16 | import kotlinx.coroutines.* 17 | import kotlinx.coroutines.Dispatchers 18 | 19 | class SmartTextFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { 20 | private lateinit var channel: MethodChannel 21 | private var activity: Activity? = null 22 | private val mainScope = CoroutineScope(Dispatchers.Main) 23 | private lateinit var textClassificationManager: TextClassificationManager 24 | private lateinit var textClassifer: TextClassifer 25 | 26 | override fun onAttachedToEngine(flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { 27 | channel = MethodChannel(flutterPluginBinding.binaryMessenger, "smart_text_flutter") 28 | channel.setMethodCallHandler(this) 29 | } 30 | 31 | override fun onMethodCall(call: MethodCall, result: Result) { 32 | if (call.method == "classifyText") { 33 | val argument = call.arguments() as String? 34 | var itemSpans = listOf(); 35 | mainScope.launch { 36 | try { 37 | withContext(Dispatchers.Default) { 38 | itemSpans = classifyText(argument) 39 | } 40 | result.success(itemSpans.map { it.toMap() }) 41 | } catch (e: Throwable) { 42 | result.success(itemSpans) 43 | } 44 | } 45 | 46 | } else { 47 | result.notImplemented() 48 | } 49 | } 50 | 51 | override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) { 52 | channel.setMethodCallHandler(null) 53 | } 54 | 55 | override fun onAttachedToActivity(binding: ActivityPluginBinding) { 56 | activity = binding.activity as FlutterActivity 57 | initClassificationManager() 58 | } 59 | 60 | override fun onDetachedFromActivityForConfigChanges() { 61 | activity = null 62 | } 63 | 64 | override fun onReattachedToActivityForConfigChanges(binding: ActivityPluginBinding) { 65 | activity = binding.activity as FlutterActivity 66 | initClassificationManager() 67 | } 68 | 69 | override fun onDetachedFromActivity() { 70 | activity = null 71 | } 72 | 73 | @TargetApi(Build.VERSION_CODES.O) 74 | private fun initClassificationManager() { 75 | textClassifer = AndroidTextClassifer() 76 | textClassificationManager = 77 | activity?.getSystemService(Context.TEXT_CLASSIFICATION_SERVICE) as TextClassificationManager; 78 | } 79 | 80 | private fun classifyText(text: String?): List { 81 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { 82 | return textClassifer.detectLinksWithTextClassifier( 83 | text, 84 | textClassificationManager.textClassifier, 85 | ); 86 | } else { 87 | return textClassifer.detectLinksWithLinkify(text); 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /android/src/main/kotlin/com/developerjamiu/smart_text_flutter/TextClassifier.kt: -------------------------------------------------------------------------------- 1 | package com.developerjamiu.smart_text_flutter 2 | 3 | import android.annotation.TargetApi 4 | import android.os.Build 5 | import android.text.SpannableStringBuilder 6 | import android.text.style.URLSpan 7 | import android.text.util.Linkify 8 | import android.view.textclassifier.TextClassifier 9 | import android.view.textclassifier.TextLinks 10 | import android.view.textclassifier.TextSelection 11 | 12 | interface TextClassifer { 13 | fun detectLinksWithTextClassifier(text: String?, classifier: TextClassifier): List 14 | 15 | fun detectLinksWithLinkify(text: String?): List 16 | } 17 | 18 | class AndroidTextClassifer : TextClassifer { 19 | 20 | @TargetApi(Build.VERSION_CODES.P) 21 | override fun detectLinksWithTextClassifier( 22 | text: String?, 23 | classifier: TextClassifier 24 | ): List { 25 | if (text == null) return listOf(); 26 | 27 | val classifiedText = classifier.generateLinks(buildGenerateLinksRequest(text)); 28 | 29 | val linkResult = classifiedText.links.map { textLink -> 30 | LinkResult( 31 | textLink.start, 32 | textLink.end, 33 | textLink.getEntity(0), 34 | ) 35 | }.toList() 36 | 37 | return generateSmartTextItemsFromLinks(text, linkResult); 38 | } 39 | 40 | @TargetApi(Build.VERSION_CODES.P) 41 | private fun buildGenerateLinksRequest(text: String): TextLinks.Request { 42 | return TextLinks.Request.Builder(text).build() 43 | } 44 | 45 | // For devices with SDk less than 30 46 | override fun detectLinksWithLinkify(text: String?): List { 47 | if (text == null) return listOf(); 48 | 49 | val spannableStringBuilder = SpannableStringBuilder(text) 50 | Linkify.addLinks( 51 | spannableStringBuilder, 52 | Linkify.EMAIL_ADDRESSES + Linkify.PHONE_NUMBERS + Linkify.WEB_URLS 53 | ) 54 | 55 | val spans = spannableStringBuilder.getSpans(0, text.length, URLSpan::class.java) 56 | 57 | val linkResult = spans.map { span -> 58 | LinkResult( 59 | spannableStringBuilder.getSpanStart(span), 60 | spannableStringBuilder.getSpanEnd(span), 61 | getLinkType(span.url) 62 | ) 63 | }.toList() 64 | 65 | return generateSmartTextItemsFromLinks(text, linkResult); 66 | } 67 | 68 | private fun getLinkType(link: String): String { 69 | return when { 70 | link.startsWith("mailto") -> "email" 71 | link.startsWith("tel") -> "phone" 72 | else -> "url" 73 | } 74 | } 75 | 76 | private fun generateSmartTextItemsFromLinks( 77 | text: String, 78 | links: List 79 | ): List { 80 | val resultList = mutableListOf() 81 | 82 | if (links.isEmpty()) return if (text.isNotEmpty()) listOf( 83 | ItemSpan( 84 | text, 85 | "text", 86 | text, 87 | ) 88 | ) else listOf() 89 | 90 | var previousEnd = 0 91 | 92 | for (i in links.indices) { 93 | val currentLink = links[i] 94 | val textBefore = text.substring(previousEnd, currentLink.start) 95 | if (textBefore.isNotEmpty()) resultList.add(ItemSpan(textBefore, "text", textBefore)) 96 | 97 | val currentText = text.substring(currentLink.start, currentLink.end) 98 | val linkSpan: ItemSpan = when (currentLink.type) { 99 | "address" -> ItemSpan(currentText, "address", currentText) 100 | "phone" -> { 101 | val phone = if (currentText.startsWith("tel://")) { 102 | currentText 103 | } else { 104 | "tel://$currentText" 105 | } 106 | ItemSpan(currentText, "phone", phone) 107 | } 108 | "email" -> { 109 | val email = if (currentText.startsWith("mailto:")) { 110 | currentText 111 | } else { 112 | "mailto:$currentText" 113 | } 114 | ItemSpan(currentText, "email", email) 115 | } 116 | "datetime" -> ItemSpan( 117 | currentText, 118 | "datetime", 119 | currentText 120 | ) 121 | "url" -> { 122 | val url = if (currentText.startsWith("http://") || currentText.startsWith("https://")) { 123 | currentText 124 | } else { 125 | "https://$currentText" 126 | } 127 | ItemSpan(currentText, "url", url) 128 | } 129 | else -> ItemSpan(currentText, "text", currentText) 130 | } 131 | 132 | resultList.add(linkSpan) 133 | previousEnd = currentLink.end 134 | } 135 | 136 | val textAfter = text.substring(links.last().end) 137 | if (textAfter.isNotEmpty()) resultList.add(ItemSpan(textAfter, "text", textAfter)) 138 | 139 | return resultList 140 | } 141 | } -------------------------------------------------------------------------------- /android/src/test/kotlin/com/developerjamiu/smart_text_flutter/SmartTextFlutterPluginTest.kt: -------------------------------------------------------------------------------- 1 | package com.developerjamiu.smart_text_flutter 2 | 3 | import io.flutter.plugin.common.MethodCall 4 | import io.flutter.plugin.common.MethodChannel 5 | import kotlin.test.Test 6 | import org.mockito.Mockito 7 | 8 | /* 9 | * This demonstrates a simple unit test of the Kotlin portion of this plugin's implementation. 10 | * 11 | * Once you have built the plugin's example app, you can run these tests from the command 12 | * line by running `./gradlew testDebugUnitTest` in the `example/android/` directory, or 13 | * you can run them directly from IDEs that support JUnit such as Android Studio. 14 | */ 15 | 16 | internal class SmartTextFlutterPluginTest { 17 | @Test 18 | fun onMethodCall_getPlatformVersion_returnsExpectedValue() { 19 | val plugin = SmartTextFlutterPlugin() 20 | 21 | val call = MethodCall("getPlatformVersion", null) 22 | val mockResult: MethodChannel.Result = Mockito.mock(MethodChannel.Result::class.java) 23 | plugin.onMethodCall(call, mockResult) 24 | 25 | Mockito.verify(mockResult).success("Android " + android.os.Build.VERSION.RELEASE) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .build/ 9 | .buildlog/ 10 | .history 11 | .svn/ 12 | .swiftpm/ 13 | migrate_working_dir/ 14 | 15 | # IntelliJ related 16 | *.iml 17 | *.ipr 18 | *.iws 19 | .idea/ 20 | 21 | # The .vscode folder contains launch configuration and tasks you configure in 22 | # VS Code which you may wish to be included in version control, so this line 23 | # is commented out by default. 24 | #.vscode/ 25 | 26 | # Flutter/Dart/Pub related 27 | **/doc/api/ 28 | **/ios/Flutter/.last_build_id 29 | .dart_tool/ 30 | .flutter-plugins 31 | .flutter-plugins-dependencies 32 | .pub-cache/ 33 | .pub/ 34 | /build/ 35 | 36 | # Symbolication related 37 | app.*.symbols 38 | 39 | # Obfuscation related 40 | app.*.map.json 41 | 42 | # Android Studio will place build artifacts here 43 | /android/app/debug 44 | /android/app/profile 45 | /android/app/release 46 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # smart_text_flutter_example 2 | 3 | Demonstrates how to use the smart_text_flutter plugin. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) 13 | 14 | For help getting started with Flutter development, view the 15 | [online documentation](https://docs.flutter.dev/), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at https://dart.dev/lints. 17 | # 18 | # Instead of disabling a lint rule for the entire project in the 19 | # section below, it can also be suppressed for a single line of code 20 | # or a specific dart file by using the `// ignore: name_of_lint` and 21 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 22 | # producing the lint. 23 | rules: 24 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 25 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 26 | 27 | # Additional information about this file can be found at 28 | # https://dart.dev/guides/language/analysis-options 29 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "com.android.application" 3 | id "kotlin-android" 4 | id "dev.flutter.flutter-gradle-plugin" 5 | } 6 | 7 | def localProperties = new Properties() 8 | def localPropertiesFile = rootProject.file('local.properties') 9 | if (localPropertiesFile.exists()) { 10 | localPropertiesFile.withReader('UTF-8') { reader -> 11 | localProperties.load(reader) 12 | } 13 | } 14 | 15 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 16 | if (flutterVersionCode == null) { 17 | flutterVersionCode = '1' 18 | } 19 | 20 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 21 | if (flutterVersionName == null) { 22 | flutterVersionName = '1.0' 23 | } 24 | 25 | android { 26 | namespace "com.developerjamiu.smart_text_flutter_example" 27 | compileSdkVersion flutter.compileSdkVersion 28 | ndkVersion flutter.ndkVersion 29 | 30 | compileOptions { 31 | sourceCompatibility JavaVersion.VERSION_1_8 32 | targetCompatibility JavaVersion.VERSION_1_8 33 | } 34 | 35 | kotlinOptions { 36 | jvmTarget = '1.8' 37 | } 38 | 39 | sourceSets { 40 | main.java.srcDirs += 'src/main/kotlin' 41 | } 42 | 43 | defaultConfig { 44 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 45 | applicationId "com.developerjamiu.smart_text_flutter_example" 46 | // You can update the following values to match your application needs. 47 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. 48 | minSdkVersion flutter.minSdkVersion 49 | targetSdkVersion flutter.targetSdkVersion 50 | versionCode flutterVersionCode.toInteger() 51 | versionName flutterVersionName 52 | } 53 | 54 | buildTypes { 55 | release { 56 | // TODO: Add your own signing config for the release build. 57 | // Signing with the debug keys for now, so `flutter run --release` works. 58 | signingConfig signingConfigs.debug 59 | } 60 | } 61 | } 62 | 63 | flutter { 64 | source '../..' 65 | } 66 | 67 | dependencies {} 68 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 14 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | 29 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/developerjamiu/smart_text_flutter_example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.developerjamiu.smart_text_flutter_example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developerjamiu/smart-text-flutter/2c7cd02d349020edd354377c7223ccd54e1d424a/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developerjamiu/smart-text-flutter/2c7cd02d349020edd354377c7223ccd54e1d424a/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developerjamiu/smart-text-flutter/2c7cd02d349020edd354377c7223ccd54e1d424a/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developerjamiu/smart-text-flutter/2c7cd02d349020edd354377c7223ccd54e1d424a/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developerjamiu/smart-text-flutter/2c7cd02d349020edd354377c7223ccd54e1d424a/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.7.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 10 | } 11 | } 12 | 13 | allprojects { 14 | repositories { 15 | google() 16 | mavenCentral() 17 | } 18 | } 19 | 20 | rootProject.buildDir = '../build' 21 | subprojects { 22 | project.buildDir = "${rootProject.buildDir}/${project.name}" 23 | } 24 | subprojects { 25 | project.evaluationDependsOn(':app') 26 | } 27 | 28 | tasks.register("clean", Delete) { 29 | delete rootProject.buildDir 30 | } 31 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx4G 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip 6 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | def flutterSdkPath = { 3 | def properties = new Properties() 4 | file("local.properties").withInputStream { properties.load(it) } 5 | def flutterSdkPath = properties.getProperty("flutter.sdk") 6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 7 | return flutterSdkPath 8 | } 9 | settings.ext.flutterSdkPath = flutterSdkPath() 10 | 11 | includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") 12 | 13 | repositories { 14 | google() 15 | mavenCentral() 16 | gradlePluginPortal() 17 | } 18 | 19 | plugins { 20 | id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false 21 | } 22 | } 23 | 24 | plugins { 25 | id "dev.flutter.flutter-plugin-loader" version "1.0.0" 26 | id "com.android.application" version "8.1.0" apply false 27 | } 28 | 29 | include ":app" 30 | -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 12.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '12.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | target 'RunnerTests' do 36 | inherit! :search_paths 37 | end 38 | end 39 | 40 | post_install do |installer| 41 | installer.pods_project.targets.each do |target| 42 | flutter_additional_ios_build_settings(target) 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Flutter (1.0.0) 3 | - integration_test (0.0.1): 4 | - Flutter 5 | - smart_text_flutter (0.0.1): 6 | - Flutter 7 | - url_launcher_ios (0.0.1): 8 | - Flutter 9 | 10 | DEPENDENCIES: 11 | - Flutter (from `Flutter`) 12 | - integration_test (from `.symlinks/plugins/integration_test/ios`) 13 | - smart_text_flutter (from `.symlinks/plugins/smart_text_flutter/ios`) 14 | - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) 15 | 16 | EXTERNAL SOURCES: 17 | Flutter: 18 | :path: Flutter 19 | integration_test: 20 | :path: ".symlinks/plugins/integration_test/ios" 21 | smart_text_flutter: 22 | :path: ".symlinks/plugins/smart_text_flutter/ios" 23 | url_launcher_ios: 24 | :path: ".symlinks/plugins/url_launcher_ios/ios" 25 | 26 | SPEC CHECKSUMS: 27 | Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 28 | integration_test: 252f60fa39af5e17c3aa9899d35d908a0721b573 29 | smart_text_flutter: fe08e460b88733c16c57f19f64cfd1dd4814f551 30 | url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe 31 | 32 | PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796 33 | 34 | COCOAPODS: 1.16.2 35 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 54; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; 12 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 13 | 3FFE7793EC968612C40A374A /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D302805706822073A4BE320C /* Pods_RunnerTests.framework */; }; 14 | 561506F21648DCC2D5B6C450 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7908A75DCE201D6B57BCF1F3 /* Pods_Runner.framework */; }; 15 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 16 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 17 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 18 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = 97C146E61CF9000F007C117D /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = 97C146ED1CF9000F007C117D; 27 | remoteInfo = Runner; 28 | }; 29 | /* End PBXContainerItemProxy section */ 30 | 31 | /* Begin PBXCopyFilesBuildPhase section */ 32 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 33 | isa = PBXCopyFilesBuildPhase; 34 | buildActionMask = 2147483647; 35 | dstPath = ""; 36 | dstSubfolderSpec = 10; 37 | files = ( 38 | ); 39 | name = "Embed Frameworks"; 40 | runOnlyForDeploymentPostprocessing = 0; 41 | }; 42 | /* End PBXCopyFilesBuildPhase section */ 43 | 44 | /* Begin PBXFileReference section */ 45 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 46 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 47 | 2E866D6DDD924732BA1EC09E /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 48 | 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; 49 | 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 51 | 5BEB797E8DF749585106B31B /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; 52 | 61D58A36FAD1EBFAC08D80C6 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; 53 | 71A978E0C89E89B0F5DFC6C8 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 54 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 55 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 56 | 7908A75DCE201D6B57BCF1F3 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 57 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 58 | 8086FC9253501652F7466009 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; 59 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 60 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 61 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 62 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 63 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 64 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 65 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 66 | C3FA9CBCC7B9B05A06C3E4E6 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 67 | D302805706822073A4BE320C /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 68 | /* End PBXFileReference section */ 69 | 70 | /* Begin PBXFrameworksBuildPhase section */ 71 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 72 | isa = PBXFrameworksBuildPhase; 73 | buildActionMask = 2147483647; 74 | files = ( 75 | 561506F21648DCC2D5B6C450 /* Pods_Runner.framework in Frameworks */, 76 | ); 77 | runOnlyForDeploymentPostprocessing = 0; 78 | }; 79 | F57C36F3E875964939325EC3 /* Frameworks */ = { 80 | isa = PBXFrameworksBuildPhase; 81 | buildActionMask = 2147483647; 82 | files = ( 83 | 3FFE7793EC968612C40A374A /* Pods_RunnerTests.framework in Frameworks */, 84 | ); 85 | runOnlyForDeploymentPostprocessing = 0; 86 | }; 87 | /* End PBXFrameworksBuildPhase section */ 88 | 89 | /* Begin PBXGroup section */ 90 | 331C8082294A63A400263BE5 /* RunnerTests */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | 331C807B294A618700263BE5 /* RunnerTests.swift */, 94 | ); 95 | path = RunnerTests; 96 | sourceTree = ""; 97 | }; 98 | 8085376051D7C2CA8B93C417 /* Pods */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 2E866D6DDD924732BA1EC09E /* Pods-Runner.debug.xcconfig */, 102 | C3FA9CBCC7B9B05A06C3E4E6 /* Pods-Runner.release.xcconfig */, 103 | 71A978E0C89E89B0F5DFC6C8 /* Pods-Runner.profile.xcconfig */, 104 | 5BEB797E8DF749585106B31B /* Pods-RunnerTests.debug.xcconfig */, 105 | 61D58A36FAD1EBFAC08D80C6 /* Pods-RunnerTests.release.xcconfig */, 106 | 8086FC9253501652F7466009 /* Pods-RunnerTests.profile.xcconfig */, 107 | ); 108 | path = Pods; 109 | sourceTree = ""; 110 | }; 111 | 9740EEB11CF90186004384FC /* Flutter */ = { 112 | isa = PBXGroup; 113 | children = ( 114 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 115 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 116 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 117 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 118 | ); 119 | name = Flutter; 120 | sourceTree = ""; 121 | }; 122 | 97C146E51CF9000F007C117D = { 123 | isa = PBXGroup; 124 | children = ( 125 | 9740EEB11CF90186004384FC /* Flutter */, 126 | 97C146F01CF9000F007C117D /* Runner */, 127 | 97C146EF1CF9000F007C117D /* Products */, 128 | 331C8082294A63A400263BE5 /* RunnerTests */, 129 | 8085376051D7C2CA8B93C417 /* Pods */, 130 | B1711B5DCB1F7BF7552E0E95 /* Frameworks */, 131 | ); 132 | sourceTree = ""; 133 | }; 134 | 97C146EF1CF9000F007C117D /* Products */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | 97C146EE1CF9000F007C117D /* Runner.app */, 138 | 331C8081294A63A400263BE5 /* RunnerTests.xctest */, 139 | ); 140 | name = Products; 141 | sourceTree = ""; 142 | }; 143 | 97C146F01CF9000F007C117D /* Runner */ = { 144 | isa = PBXGroup; 145 | children = ( 146 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 147 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 148 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 149 | 97C147021CF9000F007C117D /* Info.plist */, 150 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 151 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 152 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 153 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 154 | ); 155 | path = Runner; 156 | sourceTree = ""; 157 | }; 158 | B1711B5DCB1F7BF7552E0E95 /* Frameworks */ = { 159 | isa = PBXGroup; 160 | children = ( 161 | 7908A75DCE201D6B57BCF1F3 /* Pods_Runner.framework */, 162 | D302805706822073A4BE320C /* Pods_RunnerTests.framework */, 163 | ); 164 | name = Frameworks; 165 | sourceTree = ""; 166 | }; 167 | /* End PBXGroup section */ 168 | 169 | /* Begin PBXNativeTarget section */ 170 | 331C8080294A63A400263BE5 /* RunnerTests */ = { 171 | isa = PBXNativeTarget; 172 | buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; 173 | buildPhases = ( 174 | A40367F59D0C4928D091189C /* [CP] Check Pods Manifest.lock */, 175 | 331C807D294A63A400263BE5 /* Sources */, 176 | 331C807F294A63A400263BE5 /* Resources */, 177 | F57C36F3E875964939325EC3 /* Frameworks */, 178 | ); 179 | buildRules = ( 180 | ); 181 | dependencies = ( 182 | 331C8086294A63A400263BE5 /* PBXTargetDependency */, 183 | ); 184 | name = RunnerTests; 185 | productName = RunnerTests; 186 | productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */; 187 | productType = "com.apple.product-type.bundle.unit-test"; 188 | }; 189 | 97C146ED1CF9000F007C117D /* Runner */ = { 190 | isa = PBXNativeTarget; 191 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 192 | buildPhases = ( 193 | FB50DDB84873BFF01F9A87FD /* [CP] Check Pods Manifest.lock */, 194 | 9740EEB61CF901F6004384FC /* Run Script */, 195 | 97C146EA1CF9000F007C117D /* Sources */, 196 | 97C146EB1CF9000F007C117D /* Frameworks */, 197 | 97C146EC1CF9000F007C117D /* Resources */, 198 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 199 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 200 | 1497ADF18DFA73ED96E8202E /* [CP] Embed Pods Frameworks */, 201 | ); 202 | buildRules = ( 203 | ); 204 | dependencies = ( 205 | ); 206 | name = Runner; 207 | productName = Runner; 208 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 209 | productType = "com.apple.product-type.application"; 210 | }; 211 | /* End PBXNativeTarget section */ 212 | 213 | /* Begin PBXProject section */ 214 | 97C146E61CF9000F007C117D /* Project object */ = { 215 | isa = PBXProject; 216 | attributes = { 217 | BuildIndependentTargetsInParallel = YES; 218 | LastUpgradeCheck = 1510; 219 | ORGANIZATIONNAME = ""; 220 | TargetAttributes = { 221 | 331C8080294A63A400263BE5 = { 222 | CreatedOnToolsVersion = 14.0; 223 | TestTargetID = 97C146ED1CF9000F007C117D; 224 | }; 225 | 97C146ED1CF9000F007C117D = { 226 | CreatedOnToolsVersion = 7.3.1; 227 | LastSwiftMigration = 1100; 228 | }; 229 | }; 230 | }; 231 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 232 | compatibilityVersion = "Xcode 9.3"; 233 | developmentRegion = en; 234 | hasScannedForEncodings = 0; 235 | knownRegions = ( 236 | en, 237 | Base, 238 | ); 239 | mainGroup = 97C146E51CF9000F007C117D; 240 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 241 | projectDirPath = ""; 242 | projectRoot = ""; 243 | targets = ( 244 | 97C146ED1CF9000F007C117D /* Runner */, 245 | 331C8080294A63A400263BE5 /* RunnerTests */, 246 | ); 247 | }; 248 | /* End PBXProject section */ 249 | 250 | /* Begin PBXResourcesBuildPhase section */ 251 | 331C807F294A63A400263BE5 /* Resources */ = { 252 | isa = PBXResourcesBuildPhase; 253 | buildActionMask = 2147483647; 254 | files = ( 255 | ); 256 | runOnlyForDeploymentPostprocessing = 0; 257 | }; 258 | 97C146EC1CF9000F007C117D /* Resources */ = { 259 | isa = PBXResourcesBuildPhase; 260 | buildActionMask = 2147483647; 261 | files = ( 262 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 263 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 264 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 265 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 266 | ); 267 | runOnlyForDeploymentPostprocessing = 0; 268 | }; 269 | /* End PBXResourcesBuildPhase section */ 270 | 271 | /* Begin PBXShellScriptBuildPhase section */ 272 | 1497ADF18DFA73ED96E8202E /* [CP] Embed Pods Frameworks */ = { 273 | isa = PBXShellScriptBuildPhase; 274 | buildActionMask = 2147483647; 275 | files = ( 276 | ); 277 | inputFileListPaths = ( 278 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", 279 | ); 280 | name = "[CP] Embed Pods Frameworks"; 281 | outputFileListPaths = ( 282 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", 283 | ); 284 | runOnlyForDeploymentPostprocessing = 0; 285 | shellPath = /bin/sh; 286 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 287 | showEnvVarsInLog = 0; 288 | }; 289 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 290 | isa = PBXShellScriptBuildPhase; 291 | alwaysOutOfDate = 1; 292 | buildActionMask = 2147483647; 293 | files = ( 294 | ); 295 | inputPaths = ( 296 | "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", 297 | ); 298 | name = "Thin Binary"; 299 | outputPaths = ( 300 | ); 301 | runOnlyForDeploymentPostprocessing = 0; 302 | shellPath = /bin/sh; 303 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 304 | }; 305 | 9740EEB61CF901F6004384FC /* Run Script */ = { 306 | isa = PBXShellScriptBuildPhase; 307 | alwaysOutOfDate = 1; 308 | buildActionMask = 2147483647; 309 | files = ( 310 | ); 311 | inputPaths = ( 312 | ); 313 | name = "Run Script"; 314 | outputPaths = ( 315 | ); 316 | runOnlyForDeploymentPostprocessing = 0; 317 | shellPath = /bin/sh; 318 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 319 | }; 320 | A40367F59D0C4928D091189C /* [CP] Check Pods Manifest.lock */ = { 321 | isa = PBXShellScriptBuildPhase; 322 | buildActionMask = 2147483647; 323 | files = ( 324 | ); 325 | inputFileListPaths = ( 326 | ); 327 | inputPaths = ( 328 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 329 | "${PODS_ROOT}/Manifest.lock", 330 | ); 331 | name = "[CP] Check Pods Manifest.lock"; 332 | outputFileListPaths = ( 333 | ); 334 | outputPaths = ( 335 | "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", 336 | ); 337 | runOnlyForDeploymentPostprocessing = 0; 338 | shellPath = /bin/sh; 339 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 340 | showEnvVarsInLog = 0; 341 | }; 342 | FB50DDB84873BFF01F9A87FD /* [CP] Check Pods Manifest.lock */ = { 343 | isa = PBXShellScriptBuildPhase; 344 | buildActionMask = 2147483647; 345 | files = ( 346 | ); 347 | inputFileListPaths = ( 348 | ); 349 | inputPaths = ( 350 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 351 | "${PODS_ROOT}/Manifest.lock", 352 | ); 353 | name = "[CP] Check Pods Manifest.lock"; 354 | outputFileListPaths = ( 355 | ); 356 | outputPaths = ( 357 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 358 | ); 359 | runOnlyForDeploymentPostprocessing = 0; 360 | shellPath = /bin/sh; 361 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 362 | showEnvVarsInLog = 0; 363 | }; 364 | /* End PBXShellScriptBuildPhase section */ 365 | 366 | /* Begin PBXSourcesBuildPhase section */ 367 | 331C807D294A63A400263BE5 /* Sources */ = { 368 | isa = PBXSourcesBuildPhase; 369 | buildActionMask = 2147483647; 370 | files = ( 371 | 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */, 372 | ); 373 | runOnlyForDeploymentPostprocessing = 0; 374 | }; 375 | 97C146EA1CF9000F007C117D /* Sources */ = { 376 | isa = PBXSourcesBuildPhase; 377 | buildActionMask = 2147483647; 378 | files = ( 379 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 380 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 381 | ); 382 | runOnlyForDeploymentPostprocessing = 0; 383 | }; 384 | /* End PBXSourcesBuildPhase section */ 385 | 386 | /* Begin PBXTargetDependency section */ 387 | 331C8086294A63A400263BE5 /* PBXTargetDependency */ = { 388 | isa = PBXTargetDependency; 389 | target = 97C146ED1CF9000F007C117D /* Runner */; 390 | targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */; 391 | }; 392 | /* End PBXTargetDependency section */ 393 | 394 | /* Begin PBXVariantGroup section */ 395 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 396 | isa = PBXVariantGroup; 397 | children = ( 398 | 97C146FB1CF9000F007C117D /* Base */, 399 | ); 400 | name = Main.storyboard; 401 | sourceTree = ""; 402 | }; 403 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 404 | isa = PBXVariantGroup; 405 | children = ( 406 | 97C147001CF9000F007C117D /* Base */, 407 | ); 408 | name = LaunchScreen.storyboard; 409 | sourceTree = ""; 410 | }; 411 | /* End PBXVariantGroup section */ 412 | 413 | /* Begin XCBuildConfiguration section */ 414 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 415 | isa = XCBuildConfiguration; 416 | buildSettings = { 417 | ALWAYS_SEARCH_USER_PATHS = NO; 418 | CLANG_ANALYZER_NONNULL = YES; 419 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 420 | CLANG_CXX_LIBRARY = "libc++"; 421 | CLANG_ENABLE_MODULES = YES; 422 | CLANG_ENABLE_OBJC_ARC = YES; 423 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 424 | CLANG_WARN_BOOL_CONVERSION = YES; 425 | CLANG_WARN_COMMA = YES; 426 | CLANG_WARN_CONSTANT_CONVERSION = YES; 427 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 428 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 429 | CLANG_WARN_EMPTY_BODY = YES; 430 | CLANG_WARN_ENUM_CONVERSION = YES; 431 | CLANG_WARN_INFINITE_RECURSION = YES; 432 | CLANG_WARN_INT_CONVERSION = YES; 433 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 434 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 435 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 436 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 437 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 438 | CLANG_WARN_STRICT_PROTOTYPES = YES; 439 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 440 | CLANG_WARN_UNREACHABLE_CODE = YES; 441 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 442 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 443 | COPY_PHASE_STRIP = NO; 444 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 445 | ENABLE_NS_ASSERTIONS = NO; 446 | ENABLE_STRICT_OBJC_MSGSEND = YES; 447 | GCC_C_LANGUAGE_STANDARD = gnu99; 448 | GCC_NO_COMMON_BLOCKS = YES; 449 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 450 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 451 | GCC_WARN_UNDECLARED_SELECTOR = YES; 452 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 453 | GCC_WARN_UNUSED_FUNCTION = YES; 454 | GCC_WARN_UNUSED_VARIABLE = YES; 455 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 456 | MTL_ENABLE_DEBUG_INFO = NO; 457 | SDKROOT = iphoneos; 458 | SUPPORTED_PLATFORMS = iphoneos; 459 | TARGETED_DEVICE_FAMILY = "1,2"; 460 | VALIDATE_PRODUCT = YES; 461 | }; 462 | name = Profile; 463 | }; 464 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 465 | isa = XCBuildConfiguration; 466 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 467 | buildSettings = { 468 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 469 | CLANG_ENABLE_MODULES = YES; 470 | CODE_SIGN_IDENTITY = "Apple Development"; 471 | CODE_SIGN_STYLE = Automatic; 472 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 473 | DEVELOPMENT_TEAM = WZM25NSZ57; 474 | ENABLE_BITCODE = NO; 475 | INFOPLIST_FILE = Runner/Info.plist; 476 | LD_RUNPATH_SEARCH_PATHS = ( 477 | "$(inherited)", 478 | "@executable_path/Frameworks", 479 | ); 480 | PRODUCT_BUNDLE_IDENTIFIER = com.developerjamiu.smartTextFlutterExample; 481 | PRODUCT_NAME = "$(TARGET_NAME)"; 482 | PROVISIONING_PROFILE_SPECIFIER = ""; 483 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 484 | SWIFT_VERSION = 5.0; 485 | VERSIONING_SYSTEM = "apple-generic"; 486 | }; 487 | name = Profile; 488 | }; 489 | 331C8088294A63A400263BE5 /* Debug */ = { 490 | isa = XCBuildConfiguration; 491 | baseConfigurationReference = 5BEB797E8DF749585106B31B /* Pods-RunnerTests.debug.xcconfig */; 492 | buildSettings = { 493 | BUNDLE_LOADER = "$(TEST_HOST)"; 494 | CODE_SIGN_STYLE = Automatic; 495 | CURRENT_PROJECT_VERSION = 1; 496 | GENERATE_INFOPLIST_FILE = YES; 497 | MARKETING_VERSION = 1.0; 498 | PRODUCT_BUNDLE_IDENTIFIER = com.developerjamiu.smartTextFlutterExample.RunnerTests; 499 | PRODUCT_NAME = "$(TARGET_NAME)"; 500 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 501 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 502 | SWIFT_VERSION = 5.0; 503 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; 504 | }; 505 | name = Debug; 506 | }; 507 | 331C8089294A63A400263BE5 /* Release */ = { 508 | isa = XCBuildConfiguration; 509 | baseConfigurationReference = 61D58A36FAD1EBFAC08D80C6 /* Pods-RunnerTests.release.xcconfig */; 510 | buildSettings = { 511 | BUNDLE_LOADER = "$(TEST_HOST)"; 512 | CODE_SIGN_STYLE = Automatic; 513 | CURRENT_PROJECT_VERSION = 1; 514 | GENERATE_INFOPLIST_FILE = YES; 515 | MARKETING_VERSION = 1.0; 516 | PRODUCT_BUNDLE_IDENTIFIER = com.developerjamiu.smartTextFlutterExample.RunnerTests; 517 | PRODUCT_NAME = "$(TARGET_NAME)"; 518 | SWIFT_VERSION = 5.0; 519 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; 520 | }; 521 | name = Release; 522 | }; 523 | 331C808A294A63A400263BE5 /* Profile */ = { 524 | isa = XCBuildConfiguration; 525 | baseConfigurationReference = 8086FC9253501652F7466009 /* Pods-RunnerTests.profile.xcconfig */; 526 | buildSettings = { 527 | BUNDLE_LOADER = "$(TEST_HOST)"; 528 | CODE_SIGN_STYLE = Automatic; 529 | CURRENT_PROJECT_VERSION = 1; 530 | GENERATE_INFOPLIST_FILE = YES; 531 | MARKETING_VERSION = 1.0; 532 | PRODUCT_BUNDLE_IDENTIFIER = com.developerjamiu.smartTextFlutterExample.RunnerTests; 533 | PRODUCT_NAME = "$(TARGET_NAME)"; 534 | SWIFT_VERSION = 5.0; 535 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; 536 | }; 537 | name = Profile; 538 | }; 539 | 97C147031CF9000F007C117D /* Debug */ = { 540 | isa = XCBuildConfiguration; 541 | buildSettings = { 542 | ALWAYS_SEARCH_USER_PATHS = NO; 543 | CLANG_ANALYZER_NONNULL = YES; 544 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 545 | CLANG_CXX_LIBRARY = "libc++"; 546 | CLANG_ENABLE_MODULES = YES; 547 | CLANG_ENABLE_OBJC_ARC = YES; 548 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 549 | CLANG_WARN_BOOL_CONVERSION = YES; 550 | CLANG_WARN_COMMA = YES; 551 | CLANG_WARN_CONSTANT_CONVERSION = YES; 552 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 553 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 554 | CLANG_WARN_EMPTY_BODY = YES; 555 | CLANG_WARN_ENUM_CONVERSION = YES; 556 | CLANG_WARN_INFINITE_RECURSION = YES; 557 | CLANG_WARN_INT_CONVERSION = YES; 558 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 559 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 560 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 561 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 562 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 563 | CLANG_WARN_STRICT_PROTOTYPES = YES; 564 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 565 | CLANG_WARN_UNREACHABLE_CODE = YES; 566 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 567 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 568 | COPY_PHASE_STRIP = NO; 569 | DEBUG_INFORMATION_FORMAT = dwarf; 570 | ENABLE_STRICT_OBJC_MSGSEND = YES; 571 | ENABLE_TESTABILITY = YES; 572 | GCC_C_LANGUAGE_STANDARD = gnu99; 573 | GCC_DYNAMIC_NO_PIC = NO; 574 | GCC_NO_COMMON_BLOCKS = YES; 575 | GCC_OPTIMIZATION_LEVEL = 0; 576 | GCC_PREPROCESSOR_DEFINITIONS = ( 577 | "DEBUG=1", 578 | "$(inherited)", 579 | ); 580 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 581 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 582 | GCC_WARN_UNDECLARED_SELECTOR = YES; 583 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 584 | GCC_WARN_UNUSED_FUNCTION = YES; 585 | GCC_WARN_UNUSED_VARIABLE = YES; 586 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 587 | MTL_ENABLE_DEBUG_INFO = YES; 588 | ONLY_ACTIVE_ARCH = YES; 589 | SDKROOT = iphoneos; 590 | TARGETED_DEVICE_FAMILY = "1,2"; 591 | }; 592 | name = Debug; 593 | }; 594 | 97C147041CF9000F007C117D /* Release */ = { 595 | isa = XCBuildConfiguration; 596 | buildSettings = { 597 | ALWAYS_SEARCH_USER_PATHS = NO; 598 | CLANG_ANALYZER_NONNULL = YES; 599 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 600 | CLANG_CXX_LIBRARY = "libc++"; 601 | CLANG_ENABLE_MODULES = YES; 602 | CLANG_ENABLE_OBJC_ARC = YES; 603 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 604 | CLANG_WARN_BOOL_CONVERSION = YES; 605 | CLANG_WARN_COMMA = YES; 606 | CLANG_WARN_CONSTANT_CONVERSION = YES; 607 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 608 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 609 | CLANG_WARN_EMPTY_BODY = YES; 610 | CLANG_WARN_ENUM_CONVERSION = YES; 611 | CLANG_WARN_INFINITE_RECURSION = YES; 612 | CLANG_WARN_INT_CONVERSION = YES; 613 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 614 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 615 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 616 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 617 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 618 | CLANG_WARN_STRICT_PROTOTYPES = YES; 619 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 620 | CLANG_WARN_UNREACHABLE_CODE = YES; 621 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 622 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 623 | COPY_PHASE_STRIP = NO; 624 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 625 | ENABLE_NS_ASSERTIONS = NO; 626 | ENABLE_STRICT_OBJC_MSGSEND = YES; 627 | GCC_C_LANGUAGE_STANDARD = gnu99; 628 | GCC_NO_COMMON_BLOCKS = YES; 629 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 630 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 631 | GCC_WARN_UNDECLARED_SELECTOR = YES; 632 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 633 | GCC_WARN_UNUSED_FUNCTION = YES; 634 | GCC_WARN_UNUSED_VARIABLE = YES; 635 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 636 | MTL_ENABLE_DEBUG_INFO = NO; 637 | SDKROOT = iphoneos; 638 | SUPPORTED_PLATFORMS = iphoneos; 639 | SWIFT_COMPILATION_MODE = wholemodule; 640 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 641 | TARGETED_DEVICE_FAMILY = "1,2"; 642 | VALIDATE_PRODUCT = YES; 643 | }; 644 | name = Release; 645 | }; 646 | 97C147061CF9000F007C117D /* Debug */ = { 647 | isa = XCBuildConfiguration; 648 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 649 | buildSettings = { 650 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 651 | CLANG_ENABLE_MODULES = YES; 652 | CODE_SIGN_IDENTITY = "Apple Development"; 653 | CODE_SIGN_STYLE = Automatic; 654 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 655 | DEVELOPMENT_TEAM = WZM25NSZ57; 656 | ENABLE_BITCODE = NO; 657 | INFOPLIST_FILE = Runner/Info.plist; 658 | LD_RUNPATH_SEARCH_PATHS = ( 659 | "$(inherited)", 660 | "@executable_path/Frameworks", 661 | ); 662 | PRODUCT_BUNDLE_IDENTIFIER = com.developerjamiu.smartTextFlutterExample; 663 | PRODUCT_NAME = "$(TARGET_NAME)"; 664 | PROVISIONING_PROFILE_SPECIFIER = ""; 665 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 666 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 667 | SWIFT_VERSION = 5.0; 668 | VERSIONING_SYSTEM = "apple-generic"; 669 | }; 670 | name = Debug; 671 | }; 672 | 97C147071CF9000F007C117D /* Release */ = { 673 | isa = XCBuildConfiguration; 674 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 675 | buildSettings = { 676 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 677 | CLANG_ENABLE_MODULES = YES; 678 | CODE_SIGN_IDENTITY = "Apple Development"; 679 | CODE_SIGN_STYLE = Automatic; 680 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 681 | DEVELOPMENT_TEAM = WZM25NSZ57; 682 | ENABLE_BITCODE = NO; 683 | INFOPLIST_FILE = Runner/Info.plist; 684 | LD_RUNPATH_SEARCH_PATHS = ( 685 | "$(inherited)", 686 | "@executable_path/Frameworks", 687 | ); 688 | PRODUCT_BUNDLE_IDENTIFIER = com.developerjamiu.smartTextFlutterExample; 689 | PRODUCT_NAME = "$(TARGET_NAME)"; 690 | PROVISIONING_PROFILE_SPECIFIER = ""; 691 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 692 | SWIFT_VERSION = 5.0; 693 | VERSIONING_SYSTEM = "apple-generic"; 694 | }; 695 | name = Release; 696 | }; 697 | /* End XCBuildConfiguration section */ 698 | 699 | /* Begin XCConfigurationList section */ 700 | 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { 701 | isa = XCConfigurationList; 702 | buildConfigurations = ( 703 | 331C8088294A63A400263BE5 /* Debug */, 704 | 331C8089294A63A400263BE5 /* Release */, 705 | 331C808A294A63A400263BE5 /* Profile */, 706 | ); 707 | defaultConfigurationIsVisible = 0; 708 | defaultConfigurationName = Release; 709 | }; 710 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 711 | isa = XCConfigurationList; 712 | buildConfigurations = ( 713 | 97C147031CF9000F007C117D /* Debug */, 714 | 97C147041CF9000F007C117D /* Release */, 715 | 249021D3217E4FDB00AE95B9 /* Profile */, 716 | ); 717 | defaultConfigurationIsVisible = 0; 718 | defaultConfigurationName = Release; 719 | }; 720 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 721 | isa = XCConfigurationList; 722 | buildConfigurations = ( 723 | 97C147061CF9000F007C117D /* Debug */, 724 | 97C147071CF9000F007C117D /* Release */, 725 | 249021D4217E4FDB00AE95B9 /* Profile */, 726 | ); 727 | defaultConfigurationIsVisible = 0; 728 | defaultConfigurationName = Release; 729 | }; 730 | /* End XCConfigurationList section */ 731 | }; 732 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 733 | } 734 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 43 | 49 | 50 | 51 | 52 | 53 | 63 | 65 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @main 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developerjamiu/smart-text-flutter/2c7cd02d349020edd354377c7223ccd54e1d424a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developerjamiu/smart-text-flutter/2c7cd02d349020edd354377c7223ccd54e1d424a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developerjamiu/smart-text-flutter/2c7cd02d349020edd354377c7223ccd54e1d424a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developerjamiu/smart-text-flutter/2c7cd02d349020edd354377c7223ccd54e1d424a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developerjamiu/smart-text-flutter/2c7cd02d349020edd354377c7223ccd54e1d424a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developerjamiu/smart-text-flutter/2c7cd02d349020edd354377c7223ccd54e1d424a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developerjamiu/smart-text-flutter/2c7cd02d349020edd354377c7223ccd54e1d424a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developerjamiu/smart-text-flutter/2c7cd02d349020edd354377c7223ccd54e1d424a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developerjamiu/smart-text-flutter/2c7cd02d349020edd354377c7223ccd54e1d424a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developerjamiu/smart-text-flutter/2c7cd02d349020edd354377c7223ccd54e1d424a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developerjamiu/smart-text-flutter/2c7cd02d349020edd354377c7223ccd54e1d424a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developerjamiu/smart-text-flutter/2c7cd02d349020edd354377c7223ccd54e1d424a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developerjamiu/smart-text-flutter/2c7cd02d349020edd354377c7223ccd54e1d424a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developerjamiu/smart-text-flutter/2c7cd02d349020edd354377c7223ccd54e1d424a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developerjamiu/smart-text-flutter/2c7cd02d349020edd354377c7223ccd54e1d424a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developerjamiu/smart-text-flutter/2c7cd02d349020edd354377c7223ccd54e1d424a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developerjamiu/smart-text-flutter/2c7cd02d349020edd354377c7223ccd54e1d424a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developerjamiu/smart-text-flutter/2c7cd02d349020edd354377c7223ccd54e1d424a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Smart Text Flutter 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | smart_text_flutter_example 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | CADisableMinimumFrameDurationOnPhone 45 | 46 | UIApplicationSupportsIndirectInputEvents 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /example/ios/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import XCTest 4 | 5 | @testable import smart_text_flutter 6 | 7 | // This demonstrates a simple unit test of the Swift portion of this plugin's implementation. 8 | // 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | 11 | class RunnerTests: XCTestCase { 12 | 13 | func testGetPlatformVersion() { 14 | let plugin = SmartTextFlutterPlugin() 15 | 16 | let call = FlutterMethodCall(methodName: "getPlatformVersion", arguments: []) 17 | 18 | let resultExpectation = expectation(description: "result block must be called.") 19 | plugin.handle(call) { result in 20 | XCTAssertEqual(result as! String, "iOS " + UIDevice.current.systemVersion) 21 | resultExpectation.fulfill() 22 | } 23 | waitForExpectations(timeout: 1) 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:smart_text_flutter/smart_text_flutter.dart'; 3 | 4 | void main() { 5 | runApp(const SmartTextFlutterExample()); 6 | } 7 | 8 | class SmartTextFlutterExample extends StatefulWidget { 9 | const SmartTextFlutterExample({super.key}); 10 | 11 | @override 12 | State createState() => 13 | _SmartTextFlutterExampleState(); 14 | } 15 | 16 | class _SmartTextFlutterExampleState extends State { 17 | final List messageTexts = []; 18 | 19 | late final _messageController = TextEditingController(); 20 | 21 | @override 22 | void dispose() { 23 | _messageController.dispose(); 24 | super.dispose(); 25 | } 26 | 27 | @override 28 | Widget build(BuildContext context) { 29 | return MaterialApp( 30 | debugShowCheckedModeBanner: false, 31 | home: Scaffold( 32 | appBar: AppBar( 33 | title: const Text('Smart Text Flutter'), 34 | ), 35 | body: Column( 36 | children: [ 37 | Expanded( 38 | child: ListView.builder( 39 | itemCount: messageTexts.length, 40 | itemBuilder: (context, index) => Align( 41 | alignment: Alignment.centerLeft, 42 | child: Container( 43 | constraints: BoxConstraints( 44 | maxWidth: MediaQuery.sizeOf(context).width * 0.8, 45 | ), 46 | decoration: BoxDecoration( 47 | borderRadius: BorderRadius.circular(16), 48 | color: Colors.blueGrey.shade50, 49 | ), 50 | padding: const EdgeInsets.all(8), 51 | margin: const EdgeInsets.all(8), 52 | child: SmartText( 53 | messageTexts[index], 54 | ), 55 | ), 56 | ), 57 | ), 58 | ), 59 | Padding( 60 | padding: const EdgeInsets.all(8.0), 61 | child: Row( 62 | children: [ 63 | Expanded( 64 | child: TextField( 65 | controller: _messageController, 66 | decoration: const InputDecoration( 67 | hintText: 'Enter text', 68 | contentPadding: EdgeInsets.all(8), 69 | border: OutlineInputBorder(), 70 | ), 71 | ), 72 | ), 73 | const SizedBox(width: 8), 74 | ElevatedButton( 75 | onPressed: () { 76 | setState(() => messageTexts.add(_messageController.text)); 77 | _messageController.clear(); 78 | }, 79 | child: const Text('Send Message'), 80 | ), 81 | ], 82 | ), 83 | ), 84 | const SizedBox(height: 40), 85 | ], 86 | ), 87 | ), 88 | ); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /example/lib/smart_text.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/gestures.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:smart_text_flutter/smart_text_flutter.dart'; 4 | 5 | class SmartTextExample extends StatefulWidget { 6 | const SmartTextExample(this.text, {super.key}); 7 | 8 | final String text; 9 | 10 | @override 11 | State createState() => _SmartTextExampleState(); 12 | } 13 | 14 | class _SmartTextExampleState extends State { 15 | late Future> classifyTextFuture; 16 | 17 | @override 18 | void initState() { 19 | super.initState(); 20 | 21 | classifyTextFuture = getItemSpans(); 22 | } 23 | 24 | @override 25 | void didUpdateWidget(covariant SmartTextExample oldWidget) { 26 | if (oldWidget.text != widget.text) classifyTextFuture = getItemSpans(); 27 | 28 | super.didUpdateWidget(oldWidget); 29 | } 30 | 31 | Future> getItemSpans() async { 32 | return SmartTextFlutter.classifyText(widget.text); 33 | } 34 | 35 | @override 36 | Widget build(BuildContext context) { 37 | return FutureBuilder>( 38 | future: classifyTextFuture, 39 | builder: (context, snapshot) { 40 | if (!snapshot.hasData || snapshot.data!.isEmpty) { 41 | return Text(widget.text); 42 | } 43 | 44 | return Text.rich( 45 | TextSpan( 46 | children: [ 47 | for (final span in snapshot.data!) 48 | switch (span.type) { 49 | ItemSpanType.text => TextSpan( 50 | text: span.text, 51 | ), 52 | ItemSpanType.address => TextSpan( 53 | text: span.text, 54 | // replace with link style 55 | style: const TextStyle(color: Colors.red), 56 | recognizer: TapGestureRecognizer() 57 | ..onTap = () { 58 | // perform address related action 59 | }, 60 | ), 61 | ItemSpanType.email => TextSpan( 62 | text: span.text, 63 | // replace with link style 64 | style: const TextStyle(color: Colors.blue), 65 | recognizer: TapGestureRecognizer() 66 | ..onTap = () { 67 | // perform email related action 68 | }, 69 | ), 70 | ItemSpanType.phone => TextSpan( 71 | text: span.text, 72 | // replace with link style 73 | style: const TextStyle(color: Colors.green), 74 | recognizer: TapGestureRecognizer() 75 | ..onTap = () { 76 | // perform phone related action 77 | }, 78 | ), 79 | ItemSpanType.datetime => TextSpan( 80 | text: span.text, 81 | // replace with link style 82 | style: const TextStyle(color: Colors.indigo), 83 | recognizer: TapGestureRecognizer() 84 | ..onTap = () { 85 | // perform datetime related action 86 | }, 87 | ), 88 | ItemSpanType.url => TextSpan( 89 | text: span.text, 90 | // replace with link style 91 | style: const TextStyle(color: Colors.amber), 92 | recognizer: TapGestureRecognizer() 93 | ..onTap = () { 94 | // perform url related action 95 | }, 96 | ), 97 | } 98 | ], 99 | ), 100 | ); 101 | }, 102 | ); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" 9 | url: "https://pub.dev" 10 | source: hosted 11 | version: "2.11.0" 12 | boolean_selector: 13 | dependency: transitive 14 | description: 15 | name: boolean_selector 16 | sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" 17 | url: "https://pub.dev" 18 | source: hosted 19 | version: "2.1.1" 20 | characters: 21 | dependency: transitive 22 | description: 23 | name: characters 24 | sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" 25 | url: "https://pub.dev" 26 | source: hosted 27 | version: "1.3.0" 28 | clock: 29 | dependency: transitive 30 | description: 31 | name: clock 32 | sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf 33 | url: "https://pub.dev" 34 | source: hosted 35 | version: "1.1.1" 36 | collection: 37 | dependency: transitive 38 | description: 39 | name: collection 40 | sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf 41 | url: "https://pub.dev" 42 | source: hosted 43 | version: "1.19.0" 44 | fake_async: 45 | dependency: transitive 46 | description: 47 | name: fake_async 48 | sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" 49 | url: "https://pub.dev" 50 | source: hosted 51 | version: "1.3.1" 52 | file: 53 | dependency: transitive 54 | description: 55 | name: file 56 | sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" 57 | url: "https://pub.dev" 58 | source: hosted 59 | version: "7.0.0" 60 | flutter: 61 | dependency: "direct main" 62 | description: flutter 63 | source: sdk 64 | version: "0.0.0" 65 | flutter_driver: 66 | dependency: transitive 67 | description: flutter 68 | source: sdk 69 | version: "0.0.0" 70 | flutter_lints: 71 | dependency: "direct dev" 72 | description: 73 | name: flutter_lints 74 | sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04 75 | url: "https://pub.dev" 76 | source: hosted 77 | version: "2.0.3" 78 | flutter_test: 79 | dependency: "direct dev" 80 | description: flutter 81 | source: sdk 82 | version: "0.0.0" 83 | flutter_web_plugins: 84 | dependency: transitive 85 | description: flutter 86 | source: sdk 87 | version: "0.0.0" 88 | fuchsia_remote_debug_protocol: 89 | dependency: transitive 90 | description: flutter 91 | source: sdk 92 | version: "0.0.0" 93 | integration_test: 94 | dependency: "direct dev" 95 | description: flutter 96 | source: sdk 97 | version: "0.0.0" 98 | leak_tracker: 99 | dependency: transitive 100 | description: 101 | name: leak_tracker 102 | sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06" 103 | url: "https://pub.dev" 104 | source: hosted 105 | version: "10.0.7" 106 | leak_tracker_flutter_testing: 107 | dependency: transitive 108 | description: 109 | name: leak_tracker_flutter_testing 110 | sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379" 111 | url: "https://pub.dev" 112 | source: hosted 113 | version: "3.0.8" 114 | leak_tracker_testing: 115 | dependency: transitive 116 | description: 117 | name: leak_tracker_testing 118 | sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" 119 | url: "https://pub.dev" 120 | source: hosted 121 | version: "3.0.1" 122 | lints: 123 | dependency: transitive 124 | description: 125 | name: lints 126 | sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" 127 | url: "https://pub.dev" 128 | source: hosted 129 | version: "2.1.1" 130 | matcher: 131 | dependency: transitive 132 | description: 133 | name: matcher 134 | sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb 135 | url: "https://pub.dev" 136 | source: hosted 137 | version: "0.12.16+1" 138 | material_color_utilities: 139 | dependency: transitive 140 | description: 141 | name: material_color_utilities 142 | sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec 143 | url: "https://pub.dev" 144 | source: hosted 145 | version: "0.11.1" 146 | meta: 147 | dependency: transitive 148 | description: 149 | name: meta 150 | sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 151 | url: "https://pub.dev" 152 | source: hosted 153 | version: "1.15.0" 154 | path: 155 | dependency: transitive 156 | description: 157 | name: path 158 | sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" 159 | url: "https://pub.dev" 160 | source: hosted 161 | version: "1.9.0" 162 | platform: 163 | dependency: transitive 164 | description: 165 | name: platform 166 | sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" 167 | url: "https://pub.dev" 168 | source: hosted 169 | version: "3.1.5" 170 | plugin_platform_interface: 171 | dependency: transitive 172 | description: 173 | name: plugin_platform_interface 174 | sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" 175 | url: "https://pub.dev" 176 | source: hosted 177 | version: "2.1.8" 178 | process: 179 | dependency: transitive 180 | description: 181 | name: process 182 | sha256: "21e54fd2faf1b5bdd5102afd25012184a6793927648ea81eea80552ac9405b32" 183 | url: "https://pub.dev" 184 | source: hosted 185 | version: "5.0.2" 186 | sky_engine: 187 | dependency: transitive 188 | description: flutter 189 | source: sdk 190 | version: "0.0.0" 191 | smart_text_flutter: 192 | dependency: "direct main" 193 | description: 194 | path: ".." 195 | relative: true 196 | source: path 197 | version: "0.3.2" 198 | source_span: 199 | dependency: transitive 200 | description: 201 | name: source_span 202 | sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" 203 | url: "https://pub.dev" 204 | source: hosted 205 | version: "1.10.0" 206 | stack_trace: 207 | dependency: transitive 208 | description: 209 | name: stack_trace 210 | sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377" 211 | url: "https://pub.dev" 212 | source: hosted 213 | version: "1.12.0" 214 | stream_channel: 215 | dependency: transitive 216 | description: 217 | name: stream_channel 218 | sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 219 | url: "https://pub.dev" 220 | source: hosted 221 | version: "2.1.2" 222 | string_scanner: 223 | dependency: transitive 224 | description: 225 | name: string_scanner 226 | sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" 227 | url: "https://pub.dev" 228 | source: hosted 229 | version: "1.3.0" 230 | sync_http: 231 | dependency: transitive 232 | description: 233 | name: sync_http 234 | sha256: "7f0cd72eca000d2e026bcd6f990b81d0ca06022ef4e32fb257b30d3d1014a961" 235 | url: "https://pub.dev" 236 | source: hosted 237 | version: "0.3.1" 238 | term_glyph: 239 | dependency: transitive 240 | description: 241 | name: term_glyph 242 | sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 243 | url: "https://pub.dev" 244 | source: hosted 245 | version: "1.2.1" 246 | test_api: 247 | dependency: transitive 248 | description: 249 | name: test_api 250 | sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" 251 | url: "https://pub.dev" 252 | source: hosted 253 | version: "0.7.3" 254 | url_launcher: 255 | dependency: transitive 256 | description: 257 | name: url_launcher 258 | sha256: "9d06212b1362abc2f0f0d78e6f09f726608c74e3b9462e8368bb03314aa8d603" 259 | url: "https://pub.dev" 260 | source: hosted 261 | version: "6.3.1" 262 | url_launcher_android: 263 | dependency: transitive 264 | description: 265 | name: url_launcher_android 266 | sha256: d4ed0711849dd8e33eb2dd69c25db0d0d3fdc37e0a62e629fe32f57a22db2745 267 | url: "https://pub.dev" 268 | source: hosted 269 | version: "6.3.0" 270 | url_launcher_ios: 271 | dependency: transitive 272 | description: 273 | name: url_launcher_ios 274 | sha256: "16a513b6c12bb419304e72ea0ae2ab4fed569920d1c7cb850263fe3acc824626" 275 | url: "https://pub.dev" 276 | source: hosted 277 | version: "6.3.2" 278 | url_launcher_linux: 279 | dependency: transitive 280 | description: 281 | name: url_launcher_linux 282 | sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811 283 | url: "https://pub.dev" 284 | source: hosted 285 | version: "3.1.1" 286 | url_launcher_macos: 287 | dependency: transitive 288 | description: 289 | name: url_launcher_macos 290 | sha256: b7244901ea3cf489c5335bdacda07264a6e960b1c1b1a9f91e4bc371d9e68234 291 | url: "https://pub.dev" 292 | source: hosted 293 | version: "3.1.0" 294 | url_launcher_platform_interface: 295 | dependency: transitive 296 | description: 297 | name: url_launcher_platform_interface 298 | sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" 299 | url: "https://pub.dev" 300 | source: hosted 301 | version: "2.3.2" 302 | url_launcher_web: 303 | dependency: transitive 304 | description: 305 | name: url_launcher_web 306 | sha256: fff0932192afeedf63cdd50ecbb1bc825d31aed259f02bb8dba0f3b729a5e88b 307 | url: "https://pub.dev" 308 | source: hosted 309 | version: "2.2.3" 310 | url_launcher_windows: 311 | dependency: transitive 312 | description: 313 | name: url_launcher_windows 314 | sha256: ecf9725510600aa2bb6d7ddabe16357691b6d2805f66216a97d1b881e21beff7 315 | url: "https://pub.dev" 316 | source: hosted 317 | version: "3.1.1" 318 | vector_math: 319 | dependency: transitive 320 | description: 321 | name: vector_math 322 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" 323 | url: "https://pub.dev" 324 | source: hosted 325 | version: "2.1.4" 326 | vm_service: 327 | dependency: transitive 328 | description: 329 | name: vm_service 330 | sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b 331 | url: "https://pub.dev" 332 | source: hosted 333 | version: "14.3.0" 334 | web: 335 | dependency: transitive 336 | description: 337 | name: web 338 | sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 339 | url: "https://pub.dev" 340 | source: hosted 341 | version: "0.3.0" 342 | webdriver: 343 | dependency: transitive 344 | description: 345 | name: webdriver 346 | sha256: "3d773670966f02a646319410766d3b5e1037efb7f07cc68f844d5e06cd4d61c8" 347 | url: "https://pub.dev" 348 | source: hosted 349 | version: "3.0.4" 350 | sdks: 351 | dart: ">=3.4.0 <4.0.0" 352 | flutter: ">=3.19.0" 353 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: smart_text_flutter_example 2 | description: "Demonstrates how to use the smart_text_flutter plugin." 3 | # The following line prevents the package from being accidentally published to 4 | # pub.dev using `flutter pub publish`. This is preferred for private packages. 5 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 6 | 7 | environment: 8 | sdk: '>=3.2.5 <4.0.0' 9 | 10 | # Dependencies specify other packages that your package needs in order to work. 11 | # To automatically upgrade your package dependencies to the latest versions 12 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 13 | # dependencies can be manually updated by changing the version numbers below to 14 | # the latest version available on pub.dev. To see which dependencies have newer 15 | # versions available, run `flutter pub outdated`. 16 | dependencies: 17 | flutter: 18 | sdk: flutter 19 | 20 | smart_text_flutter: 21 | # When depending on this package from a real application you should use: 22 | # smart_text_flutter: ^x.y.z 23 | # See https://dart.dev/tools/pub/dependencies#version-constraints 24 | # The example app is bundled with the plugin so we use a path dependency on 25 | # the parent directory to use the current plugin's version. 26 | path: ../ 27 | 28 | dev_dependencies: 29 | integration_test: 30 | sdk: flutter 31 | flutter_test: 32 | sdk: flutter 33 | 34 | # The "flutter_lints" package below contains a set of recommended lints to 35 | # encourage good coding practices. The lint set provided by the package is 36 | # activated in the `analysis_options.yaml` file located at the root of your 37 | # package. See that file for information about deactivating specific lint 38 | # rules and activating additional ones. 39 | flutter_lints: ^2.0.0 40 | 41 | # For information on the generic Dart part of this file, see the 42 | # following page: https://dart.dev/tools/pub/pubspec 43 | 44 | # The following section is specific to Flutter packages. 45 | flutter: 46 | 47 | # The following line ensures that the Material Icons font is 48 | # included with your application, so that you can use the icons in 49 | # the material Icons class. 50 | uses-material-design: true -------------------------------------------------------------------------------- /example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility in the flutter_test package. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:smart_text_flutter_example/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Verify Platform version', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(const SmartTextFlutterExample()); 17 | 18 | // Verify that platform version is retrieved. 19 | expect( 20 | find.byWidgetPredicate( 21 | (Widget widget) => 22 | widget is Text && widget.data!.startsWith('Running on:'), 23 | ), 24 | findsOneWidget, 25 | ); 26 | }); 27 | } 28 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | .generated/ 16 | 17 | *.pbxuser 18 | *.mode1v3 19 | *.mode2v3 20 | *.perspectivev3 21 | 22 | !default.pbxuser 23 | !default.mode1v3 24 | !default.mode2v3 25 | !default.perspectivev3 26 | 27 | xcuserdata 28 | 29 | *.moved-aside 30 | 31 | *.pyc 32 | *sync/ 33 | Icon? 34 | .tags* 35 | 36 | /Flutter/Generated.xcconfig 37 | /Flutter/ephemeral/ 38 | /Flutter/flutter_export_environment.sh -------------------------------------------------------------------------------- /ios/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developerjamiu/smart-text-flutter/2c7cd02d349020edd354377c7223ccd54e1d424a/ios/Assets/.gitkeep -------------------------------------------------------------------------------- /ios/Classes/NSDataDetectorExtension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SmartTextFlutterBridge.swift 3 | // Runner 4 | // 5 | // Created by Jamiu Okanlawon on 09/03/2024. 6 | // 7 | import Foundation 8 | 9 | enum DataDetectorType: CaseIterable { 10 | case url 11 | case date 12 | case address 13 | case phoneNumber 14 | 15 | var nsDetectorType: NSTextCheckingResult.CheckingType { 16 | switch self { 17 | case .url: 18 | return .link 19 | case .address: 20 | return .address 21 | case .phoneNumber: 22 | return .phoneNumber 23 | case .date: 24 | return .date 25 | } 26 | } 27 | } 28 | 29 | struct DataDetectorResult { 30 | let start: Int 31 | let end: Int 32 | let type: ResultType 33 | 34 | enum ResultType { 35 | case url(String) 36 | case email(String) 37 | case phone(String) 38 | case address(String) 39 | case datetime(String) 40 | } 41 | } 42 | 43 | 44 | extension NSDataDetector { 45 | convenience init(dataTypes: [DataDetectorType]) { 46 | if dataTypes.isEmpty { 47 | preconditionFailure("dataTypes array cannot be empty") 48 | } 49 | 50 | var result = dataTypes.first!.nsDetectorType.rawValue 51 | for type in dataTypes.dropFirst() { 52 | result = result | type.nsDetectorType.rawValue 53 | } 54 | 55 | try! self.init(types: result) 56 | } 57 | 58 | func findMatches(in text: String) -> [DataDetectorResult] { 59 | let matches = matches(in: text, options: [], range: NSRange(location: 0, length: text.utf16.count)) 60 | 61 | return matches.compactMap { (match) -> DataDetectorResult? in 62 | guard let range = Range(match.range, in: text) else { return nil } 63 | 64 | return processMatch(match, range: range) 65 | } 66 | } 67 | 68 | private func processMatch(_ match: NSTextCheckingResult, range: Range) -> DataDetectorResult? { 69 | if match.resultType == .link { 70 | guard let url = match.url else { return nil } 71 | 72 | if url.absoluteString.hasPrefix("mailto:") { 73 | return DataDetectorResult(start: match.range.lowerBound,end: match.range.upperBound, type: .email(url.absoluteString)) 74 | } else { 75 | return DataDetectorResult(start: match.range.lowerBound,end: match.range.upperBound, type: .url(url.absoluteString)) 76 | } 77 | } else if match.resultType == .phoneNumber { 78 | guard let phone = match.phoneNumber else { return nil } 79 | 80 | return DataDetectorResult(start: match.range.lowerBound,end: match.range.upperBound, type: .phone("tel://" + phone)) 81 | } else if match.resultType == .address { 82 | guard let address = match.addressComponents?.values.first else { return nil } 83 | 84 | return DataDetectorResult(start: match.range.lowerBound,end: match.range.upperBound, type: .address(address)) 85 | } else if match.resultType == .date { 86 | guard let date = match.date else { return nil } 87 | 88 | let dateFormatter = DateFormatter() 89 | dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ" 90 | let dateString = dateFormatter.string(from: date) 91 | 92 | return DataDetectorResult(start: match.range.lowerBound,end: match.range.upperBound, type: .datetime(dateString)) 93 | } 94 | 95 | return nil 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /ios/Classes/SmartTextFlutterPlugin.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | 4 | public class SmartTextFlutterPlugin: NSObject, FlutterPlugin { 5 | let textClassifier : TextClassifier = AppleTextClassifier(); 6 | 7 | public static func register(with registrar: FlutterPluginRegistrar) { 8 | let channel = FlutterMethodChannel(name: "smart_text_flutter", binaryMessenger: registrar.messenger()) 9 | let instance = SmartTextFlutterPlugin() 10 | registrar.addMethodCallDelegate(instance, channel: channel) 11 | } 12 | 13 | public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { 14 | switch call.method { 15 | case "classifyText": 16 | guard let args = call.arguments as? String else {return} 17 | 18 | let smartTexts = textClassifier.classifyText(text: args) 19 | result(smartTexts.map { $0.toMap() }) 20 | default: 21 | result(FlutterMethodNotImplemented) 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ios/Classes/TextClassifier.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SmartTextFlutterBridge.swift 3 | // Runner 4 | // 5 | // Created by Jamiu Okanlawon on 09/03/2024. 6 | // 7 | 8 | import Foundation 9 | 10 | protocol TextClassifier { 11 | func classifyText(text: String) -> [ItemSpan] 12 | } 13 | 14 | class AppleTextClassifier : TextClassifier { 15 | func classifyText(text: String) -> [ItemSpan] { 16 | let normalizedText = text.replacingOccurrences(of: "\r\n", with: "\n") 17 | 18 | let detector = NSDataDetector(dataTypes: DataDetectorType.allCases) 19 | 20 | let itemSpans: [DataDetectorResult] = detector.findMatches(in: normalizedText) 21 | 22 | return generateSmartTextItemsFromLinks(text: normalizedText, links: itemSpans) 23 | } 24 | 25 | private func generateSmartTextItemsFromLinks(text: String, links: [DataDetectorResult]) -> [ItemSpan] { 26 | var resultList = [ItemSpan]() 27 | 28 | if links.isEmpty { 29 | return text.isEmpty ? [ItemSpan(text: text, type: "text", rawValue: text)] : [] 30 | } 31 | 32 | var previousEnd = 0 33 | let textUTF16 = text.utf16 34 | 35 | for link in links { 36 | let utf16Start = textUTF16.index(textUTF16.startIndex, offsetBy: link.start) 37 | let utf16End = textUTF16.index(textUTF16.startIndex, offsetBy: link.end) 38 | 39 | // Convert UTF-16 indexes to String indexes 40 | let startIndex = String.Index(utf16Start, within: text)! 41 | let endIndex = String.Index(utf16End, within: text)! 42 | 43 | if previousEnd < link.start { 44 | let textBefore = String(text[text.index(text.startIndex, offsetBy: previousEnd).. [String: Any] { 97 | return [ 98 | "text": text, 99 | "type": type, 100 | "rawValue": rawValue 101 | ] 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /ios/smart_text_flutter.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. 3 | # Run `pod lib lint smart_text_flutter.podspec` to validate before publishing. 4 | # 5 | Pod::Spec.new do |s| 6 | s.name = 'smart_text_flutter' 7 | s.version = '0.0.1' 8 | s.summary = 'A new Flutter plugin project.' 9 | s.description = <<-DESC 10 | A new Flutter plugin project. 11 | DESC 12 | s.homepage = 'http://example.com' 13 | s.license = { :file => '../LICENSE' } 14 | s.author = { 'Your Company' => 'email@example.com' } 15 | s.source = { :path => '.' } 16 | s.source_files = 'Classes/**/*' 17 | s.dependency 'Flutter' 18 | s.platform = :ios, '11.0' 19 | 20 | # Flutter.framework does not contain a i386 slice. 21 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } 22 | s.swift_version = '5.0' 23 | end 24 | -------------------------------------------------------------------------------- /lib/smart_text_flutter.dart: -------------------------------------------------------------------------------- 1 | export 'src/smart_text_flutter.dart'; 2 | export 'src/models/item_span.dart'; 3 | export 'src/models/item_span_config.dart'; 4 | export 'src/widgets/smart_text.dart'; 5 | export 'src/widgets/smart_selectable_text.dart'; 6 | -------------------------------------------------------------------------------- /lib/src/extensions/item_span_default_config.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:smart_text_flutter/src/models/item_span_config.dart'; 5 | import 'package:smart_text_flutter/src/models/item_span.dart'; 6 | import 'package:url_launcher/url_launcher.dart'; 7 | 8 | extension ItemSpanDefaultConfig on ItemSpan { 9 | static const defaultStyle = TextStyle(); 10 | 11 | static const underlineStyle = TextStyle( 12 | decoration: TextDecoration.underline, 13 | ); 14 | 15 | static const coloredUnderlineStyle = TextStyle( 16 | decoration: TextDecoration.underline, 17 | color: Colors.blue, 18 | decorationColor: Colors.blue, 19 | ); 20 | 21 | ItemSpanConfig get defaultConfig { 22 | switch (type) { 23 | case ItemSpanType.text: 24 | return const ItemSpanConfig( 25 | textStyle: defaultStyle, 26 | ); 27 | case ItemSpanType.address: 28 | return ItemSpanConfig( 29 | textStyle: underlineStyle, 30 | onClicked: _onAddressClicked, 31 | ); 32 | 33 | case ItemSpanType.email: 34 | return ItemSpanConfig( 35 | textStyle: coloredUnderlineStyle, 36 | onClicked: _onEmailClicked, 37 | ); 38 | case ItemSpanType.phone: 39 | return ItemSpanConfig( 40 | textStyle: coloredUnderlineStyle, 41 | onClicked: _onPhoneClicked, 42 | ); 43 | case ItemSpanType.datetime: 44 | 45 | /// The formatted phone number is currently not returned in Android 46 | /// In this case, we do not want to represent the phone field as a 47 | /// clickable link 48 | final hasFormattedDate = text != rawValue; 49 | 50 | return ItemSpanConfig( 51 | textStyle: hasFormattedDate ? underlineStyle : null, 52 | onClicked: hasFormattedDate ? _onDateTimeClicked : null, 53 | ); 54 | case ItemSpanType.url: 55 | return ItemSpanConfig( 56 | textStyle: coloredUnderlineStyle, 57 | onClicked: _onUrlClicked, 58 | ); 59 | } 60 | } 61 | 62 | void _onAddressClicked(String address) async { 63 | Uri uri; 64 | 65 | if (Platform.isAndroid) { 66 | uri = Uri( 67 | scheme: 'geo', 68 | host: '0,0', 69 | queryParameters: {'q': address}, 70 | ); 71 | } else if (Platform.isIOS) { 72 | uri = Uri.http( 73 | 'maps.apple.com', 74 | '/', 75 | {'q': address}, 76 | ); 77 | } else { 78 | uri = Uri.https( 79 | 'www.google.com', 80 | '/maps/search/', 81 | {'api': '1', 'query': address}, 82 | ); 83 | } 84 | 85 | if (await canLaunchUrl(uri)) launchUrl(uri); 86 | } 87 | 88 | void _onDateTimeClicked(String dateTime) {} 89 | 90 | void _onEmailClicked(String email) => _launchUrl(email); 91 | 92 | void _onPhoneClicked(String phone) => _launchUrl(phone); 93 | 94 | void _onUrlClicked(String url) => _launchUrl(url); 95 | 96 | void _launchUrl(String url) async { 97 | launchUrl(Uri.parse(url)).ignore(); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /lib/src/extensions/string.dart: -------------------------------------------------------------------------------- 1 | extension StringX on String { 2 | String humanizeUrl(bool humanize) { 3 | if (!humanize) return this; 4 | if (!startsWith('http')) return this; 5 | 6 | final uri = Uri.parse(this); 7 | 8 | return uri.host; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /lib/src/models/item_span.dart: -------------------------------------------------------------------------------- 1 | enum ItemSpanType { 2 | address, 3 | phone, 4 | email, 5 | datetime, 6 | url, 7 | text; 8 | 9 | static ItemSpanType fromName(String name) { 10 | return ItemSpanType.values.firstWhere( 11 | (type) => type.name == name, 12 | orElse: () => ItemSpanType.text, 13 | ); 14 | } 15 | } 16 | 17 | class ItemSpan { 18 | const ItemSpan({ 19 | required this.text, 20 | required this.type, 21 | required this.rawValue, 22 | }); 23 | 24 | /// The text or link text to render 25 | final String text; 26 | 27 | /// The raw value used to perform actions like open an email when email text 28 | /// is clicked 29 | final String rawValue; 30 | 31 | /// The type of the span 32 | /// This is either be an address, email, phone number, url, date time or text 33 | final ItemSpanType type; 34 | 35 | factory ItemSpan.fromMap(Map map) { 36 | return ItemSpan( 37 | text: map['text'] as String, 38 | rawValue: map['rawValue'] as String, 39 | type: ItemSpanType.fromName(map['type'] as String), 40 | ); 41 | } 42 | 43 | @override 44 | String toString() => 45 | 'ItemSpan(text: $text, rawValue: $rawValue, type: $type)'; 46 | 47 | @override 48 | bool operator ==(covariant ItemSpan other) { 49 | if (identical(this, other)) return true; 50 | 51 | return other.text == text && 52 | other.type == type && 53 | other.rawValue == rawValue; 54 | } 55 | 56 | @override 57 | int get hashCode => text.hashCode ^ type.hashCode; 58 | } 59 | -------------------------------------------------------------------------------- /lib/src/models/item_span_config.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class ItemSpanConfig { 4 | /// The [TextStyle] if the link 5 | final TextStyle? textStyle; 6 | 7 | /// The method called when a link is clicked 8 | /// When the is set, the implementation will override the default 9 | /// implementation 10 | final void Function(String data)? onClicked; 11 | 12 | const ItemSpanConfig({ 13 | this.textStyle, 14 | this.onClicked, 15 | }); 16 | } 17 | -------------------------------------------------------------------------------- /lib/src/smart_text_flutter.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:smart_text_flutter/src/models/item_span.dart'; 4 | import 'package:smart_text_flutter/src/smart_text_flutter_platform_interface.dart'; 5 | 6 | class SmartTextFlutter { 7 | SmartTextFlutter._(); 8 | 9 | static final _smartTextFlutter = SmartTextFlutterPlatform.instance; 10 | 11 | /// Parses [text] into [ItemSpan] sequence 12 | /// 13 | /// Returns list of [ItemSpan]s with the classified texts arranged in sequence. 14 | /// [ItemSpan] contains the text and the type of text 15 | /// 16 | /// ```dart 17 | /// final entries = SmartTextFlutter.classifyText('text with 36 Lagos Street and link http://nigeria.com') 18 | /// // returns 19 | /// // [ 20 | /// // ItemSpan(text: 'text with ', type: ItemSpanType.text), 21 | /// // ItemSpan(text: '36 Lagos Street', type: ItemSpanType.address), 22 | /// // ItemSpan(text: ' and link ', type: ItemSpanType.text), 23 | /// // ItemSpan(text: 'http://nigeria.com', type: ItemSpanType.url), 24 | /// // ] 25 | /// ``` 26 | /// 27 | /// The method is useful when you want to show links in UI with the rest of 28 | /// the text: 29 | /// 30 | /// ```dart 31 | /// class SmartText extends StatefulWidget { 32 | /// const SmartText(this.text, {super.key}); 33 | 34 | /// final String text; 35 | 36 | /// @override 37 | /// State createState() => _SmartTextState(); 38 | /// } 39 | 40 | /// class _SmartTextState extends State { 41 | /// late Future> classifyTextFuture; 42 | 43 | /// @override 44 | /// void initState() { 45 | /// super.initState(); 46 | 47 | /// classifyTextFuture = getItemSpans(); 48 | /// } 49 | 50 | /// @override 51 | /// void didUpdateWidget(covariant SmartText oldWidget) { 52 | /// if (oldWidget.text != widget.text) classifyTextFuture = getItemSpans(); 53 | 54 | /// super.didUpdateWidget(oldWidget); 55 | /// } 56 | 57 | /// Future> getItemSpans() async { 58 | /// return SmartTextFlutter.classifyText(widget.text); 59 | /// } 60 | 61 | /// @override 62 | /// Widget build(BuildContext context) { 63 | /// return FutureBuilder>( 64 | /// future: classifyTextFuture, 65 | /// builder: (context, snapshot) { 66 | /// if (!snapshot.hasData || snapshot.data!.isEmpty) { 67 | /// return Text(widget.text); 68 | /// } 69 | 70 | /// return Text.rich( 71 | /// TextSpan( 72 | /// children: [ 73 | /// for (final span in snapshot.data!) 74 | /// switch (span.type) { 75 | /// ItemSpanType.text => TextSpan( 76 | /// text: span.text, 77 | /// ), 78 | /// ItemSpanType.address => TextSpan( 79 | /// text: span.text, 80 | /// // replace with link style 81 | /// style: const TextStyle(color: Colors.red), 82 | /// recognizer: TapGestureRecognizer() 83 | /// ..onTap = () { 84 | /// // perform address related action 85 | /// }, 86 | /// ), 87 | /// ItemSpanType.email => TextSpan( 88 | /// text: span.text, 89 | /// // replace with link style 90 | /// style: const TextStyle(color: Colors.blue), 91 | /// recognizer: TapGestureRecognizer() 92 | /// ..onTap = () { 93 | /// // perform email related action 94 | /// }, 95 | /// ), 96 | /// ItemSpanType.phone => TextSpan( 97 | /// text: span.text, 98 | /// // replace with link style 99 | /// style: const TextStyle(color: Colors.green), 100 | /// recognizer: TapGestureRecognizer() 101 | /// ..onTap = () { 102 | /// // perform phone related action 103 | /// }, 104 | /// ), 105 | /// ItemSpanType.datetime => TextSpan( 106 | /// text: span.text, 107 | /// // replace with link style 108 | /// style: const TextStyle(color: Colors.indigo), 109 | /// recognizer: TapGestureRecognizer() 110 | /// ..onTap = () { 111 | /// // perform datetime related action 112 | /// }, 113 | /// ), 114 | /// ItemSpanType.url => TextSpan( 115 | /// text: span.text, 116 | /// // replace with link style 117 | /// style: const TextStyle(color: Colors.amber), 118 | /// recognizer: TapGestureRecognizer() 119 | /// ..onTap = () { 120 | /// // perform url related action 121 | /// }, 122 | /// ), 123 | /// } 124 | /// ], 125 | /// ), 126 | /// ); 127 | /// }, 128 | /// ); 129 | /// } 130 | /// } 131 | /// ``` 132 | static Future> classifyText(String text) async { 133 | try { 134 | final result = await _smartTextFlutter.classifyText( 135 | text, 136 | ); 137 | 138 | if (result == null) return const []; 139 | 140 | return result 141 | .map((e) => ItemSpan.fromMap(Map.from(e))) 142 | .toList(); 143 | } catch (ex) { 144 | return const []; 145 | } 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /lib/src/smart_text_flutter_method_channel.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:flutter/services.dart'; 3 | 4 | import 'smart_text_flutter_platform_interface.dart'; 5 | 6 | /// An implementation of [SmartTextFlutterPlatform] that uses method channels. 7 | class MethodChannelSmartTextFlutter extends SmartTextFlutterPlatform { 8 | /// The method channel used to interact with the native platform. 9 | @visibleForTesting 10 | final methodChannel = const MethodChannel('smart_text_flutter'); 11 | 12 | @override 13 | Future classifyText(String text) async { 14 | return await methodChannel.invokeMethod( 15 | 'classifyText', 16 | text, 17 | ); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /lib/src/smart_text_flutter_platform_interface.dart: -------------------------------------------------------------------------------- 1 | import 'package:plugin_platform_interface/plugin_platform_interface.dart'; 2 | 3 | import 'smart_text_flutter_method_channel.dart'; 4 | 5 | abstract class SmartTextFlutterPlatform extends PlatformInterface { 6 | /// Constructs a SmartTextFlutterPlatform. 7 | SmartTextFlutterPlatform() : super(token: _token); 8 | 9 | static final Object _token = Object(); 10 | 11 | static SmartTextFlutterPlatform _instance = MethodChannelSmartTextFlutter(); 12 | 13 | /// The default instance of [SmartTextFlutterPlatform] to use. 14 | /// 15 | /// Defaults to [MethodChannelSmartTextFlutter]. 16 | static SmartTextFlutterPlatform get instance => _instance; 17 | 18 | /// Platform-specific implementations should set this with their own 19 | /// platform-specific class that extends [SmartTextFlutterPlatform] when 20 | /// they register themselves. 21 | static set instance(SmartTextFlutterPlatform instance) { 22 | PlatformInterface.verifyToken(instance, _token); 23 | _instance = instance; 24 | } 25 | 26 | Future classifyText(String text) { 27 | throw UnimplementedError('classifyText() has not been implemented.'); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/src/widgets/smart_selectable_text.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui' as ui show TextHeightBehavior; 2 | 3 | import 'package:flutter/gestures.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:smart_text_flutter/src/extensions/item_span_default_config.dart'; 6 | import 'package:smart_text_flutter/smart_text_flutter.dart'; 7 | import 'package:smart_text_flutter/src/extensions/string.dart'; 8 | 9 | /// The smart text which automatically detect links in text and renders them 10 | class SmartSelectableText extends StatefulWidget { 11 | const SmartSelectableText( 12 | this.text, { 13 | super.key, 14 | this.config, 15 | this.addressConfig, 16 | this.dateTimeConfig, 17 | this.emailConfig, 18 | this.phoneConfig, 19 | this.urlConfig, 20 | this.strutStyle, 21 | this.locale, 22 | this.textAlign, 23 | this.textDirection, 24 | this.maxLines, 25 | this.overflow, 26 | this.selectionColor, 27 | this.semanticsLabel, 28 | this.softWrap, 29 | this.textHeightBehavior, 30 | this.textScaler, 31 | this.textWidthBasis, 32 | this.humanize = false, 33 | }); 34 | 35 | /// The text to linkify 36 | /// This text will be classified and the links will be highlighted 37 | final String text; 38 | 39 | /// The configuration for setting the [TextStyle] and onClicked method 40 | /// This affects the whole text 41 | final ItemSpanConfig? config; 42 | 43 | /// The configuration for setting the [TextStyle] and what happens when the address link is clicked 44 | final ItemSpanConfig? addressConfig; 45 | 46 | /// The configuration for setting the [TextStyle] and what happens when the phone link is clicked 47 | final ItemSpanConfig? phoneConfig; 48 | 49 | /// The configuration for setting the [TextStyle] and what happens when the url is clicked 50 | final ItemSpanConfig? urlConfig; 51 | 52 | /// The configuration for setting the [TextStyle] and what happens when the date time is clicked 53 | final ItemSpanConfig? dateTimeConfig; 54 | 55 | /// The configuration for setting the [TextStyle] and what happens when the email link is clicked 56 | final ItemSpanConfig? emailConfig; 57 | 58 | final StrutStyle? strutStyle; 59 | 60 | final TextAlign? textAlign; 61 | 62 | final TextDirection? textDirection; 63 | 64 | final Locale? locale; 65 | 66 | final bool? softWrap; 67 | 68 | final TextOverflow? overflow; 69 | 70 | final TextScaler? textScaler; 71 | 72 | final int? maxLines; 73 | 74 | final String? semanticsLabel; 75 | 76 | final TextWidthBasis? textWidthBasis; 77 | 78 | final ui.TextHeightBehavior? textHeightBehavior; 79 | 80 | final Color? selectionColor; 81 | 82 | final bool humanize; 83 | 84 | @override 85 | State createState() => _SmartSelectableTextState(); 86 | } 87 | 88 | class _SmartSelectableTextState extends State { 89 | late Future> classifyTextFuture; 90 | 91 | @override 92 | void initState() { 93 | super.initState(); 94 | 95 | classifyTextFuture = getItemSpans(); 96 | } 97 | 98 | @override 99 | void didUpdateWidget(covariant SmartSelectableText oldWidget) { 100 | if (oldWidget.text != widget.text) classifyTextFuture = getItemSpans(); 101 | 102 | super.didUpdateWidget(oldWidget); 103 | } 104 | 105 | Future> getItemSpans() async { 106 | return SmartTextFlutter.classifyText(widget.text); 107 | } 108 | 109 | @override 110 | Widget build(BuildContext context) { 111 | return FutureBuilder>( 112 | future: classifyTextFuture, 113 | builder: (context, snapshot) { 114 | if (!snapshot.hasData || snapshot.data!.isEmpty) { 115 | return SelectableText( 116 | widget.text, 117 | style: widget.config?.textStyle, 118 | strutStyle: widget.strutStyle, 119 | textAlign: widget.textAlign, 120 | maxLines: widget.maxLines, 121 | semanticsLabel: widget.semanticsLabel, 122 | textDirection: widget.textDirection, 123 | textHeightBehavior: widget.textHeightBehavior, 124 | textScaler: widget.textScaler, 125 | textWidthBasis: widget.textWidthBasis, 126 | ); 127 | } 128 | 129 | return SelectableText.rich( 130 | TextSpan( 131 | children: [ 132 | for (final span in snapshot.data!) 133 | switch (span.type) { 134 | ItemSpanType.text => TextSpan( 135 | text: span.text, 136 | style: span.defaultConfig.textStyle?.merge( 137 | widget.config?.textStyle, 138 | ), 139 | ), 140 | ItemSpanType.address => TextSpan( 141 | text: span.text, 142 | style: span.defaultConfig.textStyle?.merge( 143 | widget.addressConfig?.textStyle, 144 | ), 145 | recognizer: TapGestureRecognizer() 146 | ..onTap = () => _handleItemSpanTap( 147 | span, 148 | widget.addressConfig, 149 | ), 150 | ), 151 | ItemSpanType.email => TextSpan( 152 | text: span.text, 153 | style: span.defaultConfig.textStyle?.merge( 154 | widget.emailConfig?.textStyle, 155 | ), 156 | recognizer: TapGestureRecognizer() 157 | ..onTap = () => _handleItemSpanTap( 158 | span, 159 | widget.emailConfig, 160 | ), 161 | ), 162 | ItemSpanType.phone => TextSpan( 163 | text: span.text, 164 | style: span.defaultConfig.textStyle?.merge( 165 | widget.phoneConfig?.textStyle, 166 | ), 167 | recognizer: TapGestureRecognizer() 168 | ..onTap = () => _handleItemSpanTap( 169 | span, 170 | widget.phoneConfig, 171 | ), 172 | ), 173 | ItemSpanType.datetime => TextSpan( 174 | text: span.text, 175 | style: span.defaultConfig.textStyle?.merge( 176 | widget.dateTimeConfig?.textStyle, 177 | ), 178 | recognizer: TapGestureRecognizer() 179 | ..onTap = () => _handleItemSpanTap( 180 | span, 181 | widget.dateTimeConfig, 182 | ), 183 | ), 184 | ItemSpanType.url => TextSpan( 185 | text: span.text.humanizeUrl(widget.humanize), 186 | style: span.defaultConfig.textStyle?.merge( 187 | widget.urlConfig?.textStyle, 188 | ), 189 | recognizer: TapGestureRecognizer() 190 | ..onTap = () => _handleItemSpanTap( 191 | span, 192 | widget.urlConfig, 193 | ), 194 | ), 195 | }, 196 | ], 197 | style: const TextStyle().merge( 198 | widget.config?.textStyle, 199 | ), 200 | ), 201 | strutStyle: widget.strutStyle, 202 | textAlign: widget.textAlign, 203 | maxLines: widget.maxLines, 204 | semanticsLabel: widget.semanticsLabel, 205 | textDirection: widget.textDirection, 206 | textHeightBehavior: widget.textHeightBehavior, 207 | textScaler: widget.textScaler, 208 | textWidthBasis: widget.textWidthBasis, 209 | ); 210 | }, 211 | ); 212 | } 213 | 214 | void _handleItemSpanTap(ItemSpan span, ItemSpanConfig? config) { 215 | if (config?.onClicked != null) { 216 | config?.onClicked?.call(span.rawValue); 217 | } else { 218 | span.defaultConfig.onClicked?.call(span.rawValue); 219 | } 220 | } 221 | } 222 | -------------------------------------------------------------------------------- /lib/src/widgets/smart_text.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui' as ui show TextHeightBehavior; 2 | 3 | import 'package:flutter/gestures.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:smart_text_flutter/src/extensions/item_span_default_config.dart'; 6 | import 'package:smart_text_flutter/smart_text_flutter.dart'; 7 | import 'package:smart_text_flutter/src/extensions/string.dart'; 8 | 9 | // TODO: Merge the SmartText and SmartSelectableText widgets 10 | /// The smart text which automatically detect links in text and renders them 11 | class SmartText extends StatefulWidget { 12 | const SmartText( 13 | this.text, { 14 | super.key, 15 | this.config, 16 | this.addressConfig, 17 | this.dateTimeConfig, 18 | this.emailConfig, 19 | this.phoneConfig, 20 | this.urlConfig, 21 | this.strutStyle, 22 | this.locale, 23 | this.textAlign, 24 | this.textDirection, 25 | this.maxLines, 26 | this.overflow, 27 | this.selectionColor, 28 | this.semanticsLabel, 29 | this.softWrap, 30 | this.textHeightBehavior, 31 | this.textScaler, 32 | this.textWidthBasis, 33 | this.humanize = false, 34 | }); 35 | 36 | /// The text to linkify 37 | /// This text will be classified and the links will be highlighted 38 | final String text; 39 | 40 | /// The configuration for setting the [TextStyle] and onClicked method 41 | /// This affects the whole text 42 | final ItemSpanConfig? config; 43 | 44 | /// The configuration for setting the [TextStyle] and what happens when the address link is clicked 45 | final ItemSpanConfig? addressConfig; 46 | 47 | /// The configuration for setting the [TextStyle] and what happens when the phone link is clicked 48 | final ItemSpanConfig? phoneConfig; 49 | 50 | /// The configuration for setting the [TextStyle] and what happens when the url is clicked 51 | final ItemSpanConfig? urlConfig; 52 | 53 | /// The configuration for setting the [TextStyle] and what happens when the date time is clicked 54 | final ItemSpanConfig? dateTimeConfig; 55 | 56 | /// The configuration for setting the [TextStyle] and what happens when the email link is clicked 57 | final ItemSpanConfig? emailConfig; 58 | 59 | final StrutStyle? strutStyle; 60 | 61 | final TextAlign? textAlign; 62 | 63 | final TextDirection? textDirection; 64 | 65 | final Locale? locale; 66 | 67 | final bool? softWrap; 68 | 69 | final TextOverflow? overflow; 70 | 71 | final TextScaler? textScaler; 72 | 73 | final int? maxLines; 74 | 75 | final String? semanticsLabel; 76 | 77 | final TextWidthBasis? textWidthBasis; 78 | 79 | final ui.TextHeightBehavior? textHeightBehavior; 80 | 81 | final Color? selectionColor; 82 | 83 | final bool humanize; 84 | 85 | @override 86 | State createState() => _SmartTextState(); 87 | } 88 | 89 | class _SmartTextState extends State { 90 | late Future> classifyTextFuture; 91 | 92 | @override 93 | void initState() { 94 | super.initState(); 95 | 96 | classifyTextFuture = getItemSpans(); 97 | } 98 | 99 | @override 100 | void didUpdateWidget(covariant SmartText oldWidget) { 101 | if (oldWidget.text != widget.text) classifyTextFuture = getItemSpans(); 102 | 103 | super.didUpdateWidget(oldWidget); 104 | } 105 | 106 | Future> getItemSpans() async { 107 | return SmartTextFlutter.classifyText(widget.text); 108 | } 109 | 110 | @override 111 | Widget build(BuildContext context) { 112 | return FutureBuilder>( 113 | future: classifyTextFuture, 114 | builder: (context, snapshot) { 115 | if (!snapshot.hasData || snapshot.data!.isEmpty) { 116 | return Text( 117 | widget.text, 118 | style: widget.config?.textStyle, 119 | strutStyle: widget.strutStyle, 120 | locale: widget.locale, 121 | textAlign: widget.textAlign, 122 | maxLines: widget.maxLines, 123 | overflow: widget.overflow, 124 | selectionColor: widget.selectionColor, 125 | semanticsLabel: widget.semanticsLabel, 126 | softWrap: widget.softWrap, 127 | textDirection: widget.textDirection, 128 | textHeightBehavior: widget.textHeightBehavior, 129 | textScaler: widget.textScaler, 130 | textWidthBasis: widget.textWidthBasis, 131 | ); 132 | } 133 | 134 | return Text.rich( 135 | TextSpan( 136 | children: [ 137 | for (final span in snapshot.data!) 138 | switch (span.type) { 139 | ItemSpanType.text => TextSpan( 140 | text: span.text, 141 | style: span.defaultConfig.textStyle?.merge( 142 | widget.config?.textStyle, 143 | ), 144 | ), 145 | ItemSpanType.address => TextSpan( 146 | text: span.text, 147 | style: span.defaultConfig.textStyle?.merge( 148 | widget.addressConfig?.textStyle, 149 | ), 150 | recognizer: TapGestureRecognizer() 151 | ..onTap = () => _handleItemSpanTap( 152 | span, 153 | widget.addressConfig, 154 | ), 155 | ), 156 | ItemSpanType.email => TextSpan( 157 | text: span.text, 158 | style: span.defaultConfig.textStyle?.merge( 159 | widget.emailConfig?.textStyle, 160 | ), 161 | recognizer: TapGestureRecognizer() 162 | ..onTap = () => _handleItemSpanTap( 163 | span, 164 | widget.emailConfig, 165 | ), 166 | ), 167 | ItemSpanType.phone => TextSpan( 168 | text: span.text, 169 | style: span.defaultConfig.textStyle?.merge( 170 | widget.phoneConfig?.textStyle, 171 | ), 172 | recognizer: TapGestureRecognizer() 173 | ..onTap = () => _handleItemSpanTap( 174 | span, 175 | widget.phoneConfig, 176 | ), 177 | ), 178 | ItemSpanType.datetime => TextSpan( 179 | text: span.text, 180 | style: span.defaultConfig.textStyle?.merge( 181 | widget.dateTimeConfig?.textStyle, 182 | ), 183 | recognizer: TapGestureRecognizer() 184 | ..onTap = () => _handleItemSpanTap( 185 | span, 186 | widget.dateTimeConfig, 187 | ), 188 | ), 189 | ItemSpanType.url => TextSpan( 190 | text: span.text.humanizeUrl(widget.humanize), 191 | style: span.defaultConfig.textStyle?.merge( 192 | widget.urlConfig?.textStyle, 193 | ), 194 | recognizer: TapGestureRecognizer() 195 | ..onTap = () => _handleItemSpanTap( 196 | span, 197 | widget.urlConfig, 198 | ), 199 | ), 200 | }, 201 | ], 202 | style: const TextStyle().merge( 203 | widget.config?.textStyle, 204 | ), 205 | ), 206 | strutStyle: widget.strutStyle, 207 | locale: widget.locale, 208 | textAlign: widget.textAlign, 209 | maxLines: widget.maxLines, 210 | overflow: widget.overflow, 211 | selectionColor: widget.selectionColor, 212 | semanticsLabel: widget.semanticsLabel, 213 | softWrap: widget.softWrap, 214 | textDirection: widget.textDirection, 215 | textHeightBehavior: widget.textHeightBehavior, 216 | textScaler: widget.textScaler, 217 | textWidthBasis: widget.textWidthBasis, 218 | ); 219 | }, 220 | ); 221 | } 222 | 223 | void _handleItemSpanTap(ItemSpan span, ItemSpanConfig? config) { 224 | if (config?.onClicked != null) { 225 | config?.onClicked?.call(span.rawValue); 226 | } else { 227 | span.defaultConfig.onClicked?.call(span.rawValue); 228 | } 229 | } 230 | } 231 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: smart_text_flutter 2 | description: "A Flutter plugin used to detect links in texts using NSDataDetector on iOS and TextClassifier on Android" 3 | version: 0.3.5 4 | homepage: https://github.com/developerjamiu/smart-text-flutter 5 | 6 | environment: 7 | sdk: ">=3.2.5 <4.0.0" 8 | flutter: ">=3.3.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | plugin_platform_interface: ^2.0.2 14 | url_launcher: ^6.3.1 15 | url_launcher_ios: ^6.3.2 16 | 17 | dev_dependencies: 18 | flutter_test: 19 | sdk: flutter 20 | flutter_lints: ^2.0.0 21 | 22 | flutter: 23 | plugin: 24 | platforms: 25 | android: 26 | package: com.developerjamiu.smart_text_flutter 27 | pluginClass: SmartTextFlutterPlugin 28 | ios: 29 | pluginClass: SmartTextFlutterPlugin 30 | -------------------------------------------------------------------------------- /test/src/smart_text_flutter_method_channel_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | import 'package:smart_text_flutter/src/smart_text_flutter_method_channel.dart'; 4 | 5 | void main() { 6 | TestWidgetsFlutterBinding.ensureInitialized(); 7 | 8 | MethodChannelSmartTextFlutter platform = MethodChannelSmartTextFlutter(); 9 | const MethodChannel channel = MethodChannel('smart_text_flutter'); 10 | 11 | setUp(() { 12 | TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger 13 | .setMockMethodCallHandler( 14 | channel, 15 | (MethodCall methodCall) async { 16 | return '42'; 17 | }, 18 | ); 19 | }); 20 | 21 | tearDown(() { 22 | TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger 23 | .setMockMethodCallHandler(channel, null); 24 | }); 25 | 26 | test('getPlatformVersion', () async { 27 | expect(await platform.classifyText(''), []); 28 | }); 29 | } 30 | --------------------------------------------------------------------------------