Skip to content

Commit

Permalink
Merge pull request #62 from santa112358/add_scaffold_to_example
Browse files Browse the repository at this point in the history
Add scaffold to example
  • Loading branch information
santa112358 authored Dec 4, 2023
2 parents 460487c + c293a5c commit b725562
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 94 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
## [3.0.2]

- Fix example

## [3.0.1]

- Fix analysis problems

## [3.0.0]
Expand Down
55 changes: 55 additions & 0 deletions example/lib/detectable_text_example.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import 'package:detectable_text_field/detector/sample_regular_expressions.dart';
import 'package:detectable_text_field/widgets/detectable_text.dart';
import 'package:flutter/material.dart';

class DetectableTextExample extends StatelessWidget {
const DetectableTextExample({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('DetectableText Example'),
),
body: Center(
child: DetectableText(
trimLines: 1,
colorClickableText: Colors.pink,
trimMode: TrimMode.Line,
trimCollapsedText: 'more',
trimExpandedText: '...less',
text:
"Welcome to #Detectable @TextField http://www.google.com this is sample text we are texting the feed text here. Welcome to #Detectable @TextField this is sample text we are texting the feed text here",
detectionRegExp: RegExp(
"(?!\\n)(?:^|\\s)([#@]([$detectionContentLetters]+))|$urlRegexContent",
multiLine: true,
),
onExpansionChanged: (bool readMore) {
debugPrint('Read more >>>>>>> $readMore');
},
onTap: (tappedText) async {
debugPrint(tappedText);
if (tappedText.startsWith('#')) {
debugPrint('DetectableText >>>>>>> #');
} else if (tappedText.startsWith('@')) {
debugPrint('DetectableText >>>>>>> @');
} else if (tappedText.startsWith('http')) {
debugPrint('DetectableText >>>>>>> http');
}
},
basicStyle: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w400,
color: Colors.grey,
),
detectedStyle: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
letterSpacing: 0.5,
color: Colors.blueAccent,
),
),
),
);
}
}
2 changes: 1 addition & 1 deletion example/lib/hooks_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class HooksExample extends HookWidget {
useListenable(controller);
return Scaffold(
appBar: AppBar(
title: const Text("Detectable text field sample"),
title: const Text("hooks example"),
),
body: Center(
child: Padding(
Expand Down
9 changes: 6 additions & 3 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@ class _TextFieldExampleState extends State<TextFieldExample> {

@override
Widget build(BuildContext context) {
return Material(
child: Column(
return Scaffold(
appBar: AppBar(
title: const Text('DetectableTextField Example'),
),
body: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Expand All @@ -58,7 +61,7 @@ class _TextFieldExampleState extends State<TextFieldExample> {
controller: controller,
),
],
)
),
);
}
}
48 changes: 0 additions & 48 deletions example/lib/read_only_text_example.dart

This file was deleted.

41 changes: 0 additions & 41 deletions example/lib/text_field_example.dart

This file was deleted.

2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: detectable_text_field
description: TextField with detection features. You can detect hashtags, at sign, url or anything you want. Helps you develop Twitter like app. Refinement of hashtagable
version: 3.0.1
version: 3.0.2
homepage: https://github.com/santa112358/detectable_text_field

environment:
Expand Down

0 comments on commit b725562

Please sign in to comment.