Skip to content

Commit

Permalink
Merge pull request #73 from fluttercandies/dev
Browse files Browse the repository at this point in the history
## [2.0.0]
  • Loading branch information
zmtzawqlp authored Jun 25, 2020
2 parents 182c552 + 4e5604c commit d273222
Show file tree
Hide file tree
Showing 19 changed files with 387 additions and 351 deletions.
17 changes: 11 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
## [2.0.0]

* Breaking change: extended_text_library has changed to support OverFlowWidget [ExtendedText]
* Fix textSelectionControls is not working.

## [1.0.1]

* Fix wrong calculation about selection handles.

## [1.0.0]

* Merge code from 1.17.0
* Fix analysis_options

## [0.5.0]

* Fix error caret offset on ios.

## [0.4.9]

* Fix error about TargetPlatform.macOS
Expand All @@ -26,10 +31,10 @@
* Set limitation of flutter sdk >=1.12.13 <1.12.16
* Add demo that how to delete text with code
* Fix issue that not showing text while entering text from keyboard

## [0.4.6]

* Remove TargetPlatform.macOS
* Remove TargetPlatform.macOS

## [0.4.5]

Expand All @@ -38,7 +43,7 @@
## [0.4.4]

* Fix wrong caret hegiht and postion
* Make Ios/Android caret the same height
* Make Ios/Android caret the same height

## [0.4.3]

Expand Down
2 changes: 1 addition & 1 deletion example/.flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider","path":"C:\\\\Users\\\\zmtza\\\\AppData\\\\Roaming\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider-1.6.9\\\\","dependencies":[]},{"name":"photo_manager","path":"C:\\\\Users\\\\zmtza\\\\AppData\\\\Roaming\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\photo_manager-0.5.2\\\\","dependencies":[]},{"name":"url_launcher","path":"C:\\\\Users\\\\zmtza\\\\AppData\\\\Roaming\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\url_launcher-5.3.0\\\\","dependencies":[]}],"android":[{"name":"path_provider","path":"C:\\\\Users\\\\zmtza\\\\AppData\\\\Roaming\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider-1.6.9\\\\","dependencies":[]},{"name":"photo_manager","path":"C:\\\\Users\\\\zmtza\\\\AppData\\\\Roaming\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\photo_manager-0.5.2\\\\","dependencies":[]},{"name":"url_launcher","path":"C:\\\\Users\\\\zmtza\\\\AppData\\\\Roaming\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\url_launcher-5.3.0\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"C:\\\\Users\\\\zmtza\\\\AppData\\\\Roaming\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_macos-0.0.4+3\\\\","dependencies":[]},{"name":"photo_manager","path":"C:\\\\Users\\\\zmtza\\\\AppData\\\\Roaming\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\photo_manager-0.5.2\\\\","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"url_launcher_web","path":"C:\\\\Users\\\\zmtza\\\\AppData\\\\Roaming\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\url_launcher_web-0.1.1+6\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"photo_manager","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web"]},{"name":"url_launcher_web","dependencies":[]}],"date_created":"2020-05-31 23:04:27.859128","version":"1.17.0"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"url_launcher","path":"C:\\\\Users\\\\zmtza\\\\AppData\\\\Roaming\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\url_launcher-5.3.0\\\\","dependencies":[]}],"android":[{"name":"url_launcher","path":"C:\\\\Users\\\\zmtza\\\\AppData\\\\Roaming\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\url_launcher-5.3.0\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[{"name":"url_launcher_web","path":"C:\\\\Users\\\\zmtza\\\\AppData\\\\Roaming\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\url_launcher_web-0.1.1+6\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"url_launcher","dependencies":["url_launcher_web"]},{"name":"url_launcher_web","dependencies":[]}],"date_created":"2020-06-25 15:31:49.830705","version":"1.17.0"}
14 changes: 0 additions & 14 deletions example/lib/example_route.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import 'package:extended_image/extended_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_candies_demo_library/flutter_candies_demo_library.dart';
import 'package:oktoast/oktoast.dart';

import 'example_route.dart';
Expand All @@ -14,9 +12,6 @@ void main() {
}

class MyApp extends StatelessWidget {
MyApp() {
clearDiskCachedImages(duration: const Duration(days: 7));
}
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
Expand All @@ -29,7 +24,6 @@ class MyApp extends StatelessWidget {
primarySwatch: Colors.blue,
),
builder: (BuildContext c, Widget w) {
ScreenUtil.init(width: 750, height: 1334, allowFontScaling: true);
// ScreenUtil.instance =
// ScreenUtil(width: 750, height: 1334, allowFontScaling: true)
// ..init(c);
Expand Down
4 changes: 2 additions & 2 deletions example/lib/pages/custom_toolbar.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

import 'package:example/special_text/my_extended_text_selection_controls.dart';
import 'package:example/special_text/my_special_text_span_builder.dart';
import 'package:extended_text_field/extended_text_field.dart';
import 'package:flutter/material.dart';
import 'package:ff_annotation_route/ff_annotation_route.dart';
import 'package:flutter_candies_demo_library/flutter_candies_demo_library.dart'
hide MySpecialTextSpanBuilder;


///
/// create by zmtzawqlp on 2019/7/31
Expand Down
23 changes: 1 addition & 22 deletions example/lib/pages/main_page.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import 'package:extended_image/extended_image.dart';
import 'package:flutter/material.dart';
import 'package:ff_annotation_route/ff_annotation_route.dart';
import 'package:flutter_candies_demo_library/flutter_candies_demo_library.dart';
import 'package:oktoast/oktoast.dart';
import 'package:url_launcher/url_launcher.dart';

import '../example_route.dart';
import '../example_routes.dart' as example_routes;
Expand Down Expand Up @@ -86,25 +84,6 @@ class MainPage extends StatelessWidget {
},
itemCount: routes.length,
),
floatingActionButton: FloatingActionButton(
onPressed: () {
///clear memory
clearMemoryImageCache();

///clear local cahced
clearDiskCachedImages().then((bool done) {
showToast(done ? 'clear succeed' : 'clear failed',
position: const ToastPosition(align: Alignment.center));
});
},
child: const Text(
'clear cache',
textAlign: TextAlign.center,
style: TextStyle(
inherit: false,
),
),
),
);
}
}
112 changes: 9 additions & 103 deletions example/lib/pages/text_demo.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import 'dart:math';
import 'package:example/common/toggle_button.dart';
import 'package:example/special_text/at_text.dart';
import 'package:example/special_text/dollar_text.dart';
import 'package:example/special_text/my_extended_text_selection_controls.dart';
import 'package:example/special_text/my_special_text_span_builder.dart';
import 'package:extended_list/extended_list.dart';
import 'package:extended_text/extended_text.dart';
import 'package:flutter/material.dart';
import 'package:extended_text_field/extended_text_field.dart';
import 'package:flutter/services.dart';
import 'package:ff_annotation_route/ff_annotation_route.dart';
import 'package:flutter_candies_demo_library/flutter_candies_demo_library.dart'
hide MySpecialTextSpanBuilder;
import 'package:loading_more_list/loading_more_list.dart';
import 'package:example/special_text/emoji_text.dart' as emoji;
import 'package:url_launcher/url_launcher.dart';

@FFRoute(
name: 'fluttercandies://TextDemo',
Expand All @@ -22,7 +24,6 @@ class TextDemo extends StatefulWidget {
}

class _TextDemoState extends State<TextDemo> {
TuChongRepository tuChongRepository;
final TextEditingController _textEditingController = TextEditingController();
final MyExtendedMaterialTextSelectionControls
_myExtendedMaterialTextSelectionControls =
Expand All @@ -31,16 +32,13 @@ class _TextDemoState extends State<TextDemo> {
final MySpecialTextSpanBuilder _mySpecialTextSpanBuilder =
MySpecialTextSpanBuilder();

List<TuChongItem> images = <TuChongItem>[];

final FocusNode _focusNode = FocusNode();
double _keyboardHeight = 267.0;
bool get showCustomKeyBoard =>
activeEmojiGird || activeAtGrid || activeDollarGrid || activeImageGrid;
activeEmojiGird || activeAtGrid || activeDollarGrid;
bool activeEmojiGird = false;
bool activeAtGrid = false;
bool activeDollarGrid = false;
bool activeImageGrid = false;
List<String> sessions = <String>[
'[44] @Dota2 CN dota best dota',
'yes, you are right [36].',
Expand All @@ -50,25 +48,14 @@ class _TextDemoState extends State<TextDemo> {
'error 0 [45] warning 0',
];

@override
void initState() {
tuChongRepository = TuChongRepository();
super.initState();
}

@override
void dispose() {
tuChongRepository.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
FocusScope.of(context).autofocus(_focusNode);
final double keyboardHeight = MediaQuery.of(context).viewInsets.bottom;
if (keyboardHeight > 0) {
activeEmojiGird =
activeAtGrid = activeDollarGrid = activeImageGrid = false;
activeAtGrid = activeDollarGrid = false;
}

_keyboardHeight = max(_keyboardHeight, keyboardHeight);
Expand Down Expand Up @@ -107,21 +94,6 @@ class _TextDemoState extends State<TextDemo> {
} else if (value.toString().startsWith('@')) {
launch('mailto:zmtzawqlp@live.com');
}
//image
else {
final TuChongItem item = images.firstWhere(
(TuChongItem x) => x.imageUrl == value.toString());
Navigator.pushNamed(context, 'fluttercandies://picswiper',
arguments: <String, dynamic>{
'index': images.indexOf(item),
'pics': item.images
.map<PicSwiperItem>((ImageItem f) =>
PicSwiperItem(
picUrl: f.imageUrl, des: f.title))
.toList(),
'tuChongItem': item,
});
}
},
);
List<Widget> list = <Widget>[
Expand Down Expand Up @@ -191,7 +163,7 @@ class _TextDemoState extends State<TextDemo> {
setState(() {
if (active) {
activeAtGrid =
activeDollarGrid = activeImageGrid = false;
activeDollarGrid = false;
FocusScope.of(context).requestFocus(_focusNode);
}
activeEmojiGird = active;
Expand Down Expand Up @@ -226,7 +198,7 @@ class _TextDemoState extends State<TextDemo> {
setState(() {
if (active) {
activeEmojiGird =
activeDollarGrid = activeImageGrid = false;
activeDollarGrid = false;
FocusScope.of(context).requestFocus(_focusNode);
}
activeAtGrid = active;
Expand All @@ -246,7 +218,7 @@ class _TextDemoState extends State<TextDemo> {
setState(() {
if (active) {
activeEmojiGird =
activeAtGrid = activeImageGrid = false;
activeAtGrid = false;
FocusScope.of(context).requestFocus(_focusNode);
}
activeDollarGrid = active;
Expand All @@ -255,26 +227,6 @@ class _TextDemoState extends State<TextDemo> {
update(change);
},
active: activeDollarGrid),
ToggleButton(
activeWidget: Icon(
Icons.picture_in_picture,
color: Colors.orange,
),
unActiveWidget: Icon(Icons.picture_in_picture),
activeChanged: (bool active) {
final Function change = () {
setState(() {
if (active) {
activeEmojiGird =
activeAtGrid = activeDollarGrid = false;
FocusScope.of(context).requestFocus(_focusNode);
}
activeImageGrid = active;
});
};
update(change);
},
active: activeImageGrid),
Container(
width: 20.0,
)
Expand Down Expand Up @@ -326,11 +278,6 @@ class _TextDemoState extends State<TextDemo> {
if (activeDollarGrid) {
return buildDollarGrid();
}
if (activeImageGrid)
return ImageGrid((TuChongItem item, String text) {
images.add(item);
insertText(text);
}, tuChongRepository);
return Container();
}

Expand Down Expand Up @@ -455,44 +402,3 @@ class _TextDemoState extends State<TextDemo> {
_textEditingController.value = value;
}
}

class ImageGrid extends StatefulWidget {
const ImageGrid(this.insertText, this.tuChongRepository);
final Function(TuChongItem item, String text) insertText;
final TuChongRepository tuChongRepository;
@override
_ImageGridState createState() => _ImageGridState();
}

class _ImageGridState extends State<ImageGrid>
with AutomaticKeepAliveClientMixin<ImageGrid> {
@override
Widget build(BuildContext context) {
super.build(context);

return LoadingMoreList<TuChongItem>(ListConfig<TuChongItem>(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3, crossAxisSpacing: 2.0, mainAxisSpacing: 2.0),
itemBuilder: (BuildContext context, TuChongItem item, int index) {
final String url = item.imageUrl;

///<img src=‘http://pic2016.5442.com:82/2016/0513/12/3.jpg!960.jpg’/>
return GestureDetector(
child: ExtendedImage.network(
url,
fit: BoxFit.scaleDown,
),
behavior: HitTestBehavior.translucent,
onTap: () {
widget.insertText?.call(item,
'<img src=\'$url\' width=\'${item.imageSize.width}\' height=\'${item.imageSize.height}\'/>');
},
);
},
padding: const EdgeInsets.all(5.0),
sourceList: widget.tuChongRepository));
}

@override
bool get wantKeepAlive => true;
}
Loading

0 comments on commit d273222

Please sign in to comment.