Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion example/lib/services/likeminds_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ class LikeMindsService implements ILikeMindsService {

int? get getFeedroomId => feedroomId;

LikeMindsService(LMSDKCallback sdkCallback, String apiKey) {
LikeMindsService(LMSDKCallback sdkCallback, String apiKey,
{Function(Exception, StackTrace)? onErrorHandler}) {
debugPrint("UI Layer: LikeMindsService initialized");
_mediaService = MediaService(_prodFlag);
final String key = apiKey.isEmpty
Expand Down
3 changes: 2 additions & 1 deletion example/lib/services/media_service.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:lm_feed_ui_example/utils/credentials/credentials.dart';
import 'package:path/path.dart';

Expand Down Expand Up @@ -29,7 +30,7 @@ class MediaService {
);
return result;
} on SimpleS3Errors catch (e) {
print(e.toString());
debugPrint(e.toString());
return null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion example/lib/views/feed/feed_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class _FeedScreenState extends State<FeedScreen> {
}

class MyPostWidget extends LMPostWidget {
MyPostWidget({
const MyPostWidget({
super.key,
required PostViewData post,
required User user,
Expand Down
3 changes: 2 additions & 1 deletion example/lib/views/new_post/new_post/new_post_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:io';

import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:likeminds_feed/likeminds_feed.dart';
import 'package:lm_feed_ui_example/services/likeminds_service.dart';
Expand Down Expand Up @@ -145,7 +146,7 @@ class NewPostBloc extends Bloc<NewPostEvents, NewPostState> {
}
} catch (err) {
emit(const NewPostError(message: 'An error occurred'));
print(err.toString());
debugPrint(err.toString());
}
}
if (event is EditPost) {
Expand Down
1 change: 0 additions & 1 deletion example/lib/views/new_post/new_post_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ class _NewPostScreenState extends State<NewPostScreen> {
@override
Widget build(BuildContext context) {
// SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark);
final screenSize = MediaQuery.of(context).size;
newPostBloc = BlocProvider.of<NewPostBloc>(context);
return WillPopScope(
onWillPop: () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class AllCommentsInitial extends AllCommentsState {
class AllCommentsLoaded extends AllCommentsState {
final PostDetailResponse postDetails;
final bool hasReachedMax;
const AllCommentsLoaded({required this.postDetails, required this.hasReachedMax});
const AllCommentsLoaded(
{required this.postDetails, required this.hasReachedMax});

@override
List<Object?> get props => [postDetails, hasReachedMax];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:async';

import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:likeminds_feed/likeminds_feed.dart';
import 'package:lm_feed_ui_example/services/likeminds_service.dart';
import 'package:lm_feed_ui_example/services/service_locator.dart';
Expand Down Expand Up @@ -40,7 +41,7 @@ class CommentRepliesBloc
} else {
emit(CommentRepliesLoading());
}
print("hellobook");
debugPrint("hellobook");

GetCommentResponse response =
await lmService.getComment(commentDetailRequest);
Expand Down
29 changes: 15 additions & 14 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: lm_feed_ui_example
description: An example app showing the usage of LikeMinds Flutter UI package based on our default designs
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
publish_to: "none" # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
Expand All @@ -16,10 +16,10 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.3.8
version: 1.3.9

environment:
sdk: '>=3.0.0 <4.0.0'
sdk: ">=3.0.0 <4.0.0"

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
Expand All @@ -31,21 +31,23 @@ dependencies:
flutter:
sdk: flutter

get_it:
get_it:
envied:
shared_preferences:
simple_s3:
shared_preferences:
simple_s3:
equatable:
bloc:
flutter_bloc:
overlay_support:
lazy_load_scrollview:
infinite_scroll_pagination:
overlay_support:
lazy_load_scrollview:
infinite_scroll_pagination:

likeminds_feed: 1.6.3
# path: ../../LikeMinds-Flutter-Feed-SDK

likeminds_feed_ui_fl:
likeminds_feed_ui_fl:
path: ../

likeminds_feed: 1.6.5
# path: ../../LikeMinds-Flutter-Feed-SDK

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
Expand All @@ -66,7 +68,6 @@ dev_dependencies:

# The following section is specific to Flutter packages.
flutter:

# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
Expand Down
6 changes: 3 additions & 3 deletions example/test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
// import 'package:flutter/material.dart';
// import 'package:flutter_test/flutter_test.dart';

import 'package:lm_feed_ui_example/main.dart';
// import 'package:lm_feed_ui_example/main.dart';

void main() {
// testWidgets('Counter increments smoke test', (WidgetTester tester) async {
Expand Down
1 change: 1 addition & 0 deletions lib/likeminds_feed_ui_fl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export 'src/utils/typedefs.dart';
export 'src/utils/helpers.dart';
export 'src/utils/utils.dart';
export 'src/models/models.dart';
export 'src/utils/constants.dart';
9 changes: 5 additions & 4 deletions lib/packages/expandable_text/expandable_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'package:flutter/material.dart';
import 'package:likeminds_feed/likeminds_feed.dart';
import 'package:likeminds_feed_ui_fl/likeminds_feed_ui_fl.dart';
import 'package:likeminds_feed_ui_fl/packages/linkify/linkify.dart';
import 'package:likeminds_feed_ui_fl/src/utils/constants.dart';
import 'package:likeminds_feed_ui_fl/src/utils/theme.dart';
import 'package:url_launcher/url_launcher.dart';

Expand Down Expand Up @@ -155,8 +154,9 @@ class ExpandableTextState extends State<ExpandableText>

final linkText =
(_expanded ? widget.collapseText : widget.expandText) ?? '';
final linkColor =
widget.linkColor ?? widget.prefixStyle?.color ?? Color(0xFF4666F6);
final linkColor = widget.linkColor ??
widget.prefixStyle?.color ??
const Color(0xFF4666F6);
final linkTextStyle = effectiveTextStyle!
.merge(widget.prefixStyle)
.copyWith(color: linkColor);
Expand Down Expand Up @@ -414,7 +414,8 @@ class ExpandableTextState extends State<ExpandableText>
} else {
bool isTag = link != null && link[0] == '<';

//if it is a valid link using linkify and if that is not then add normal TextSpan
// if it is a valid link using linkify and
// if that is not then add normal TextSpan
if (!isTag && extractLinkAndEmailFromString(link ?? '') == null) {
textSpans.add(TextSpan(
text: text.substring(startIndex, endIndex),
Expand Down
12 changes: 7 additions & 5 deletions lib/packages/expandable_text/text_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ class TextSegment {
isUrl.hashCode;
}

/// Split the string into multiple instances of [TextSegment] for mentions, hashtags, URLs and regular text.
/// Split the string into multiple instances of [TextSegment]
/// for mentions, hashtags, URLs and regular text.
///
/// Mentions are all words that start with @, e.g. @mention.
/// Hashtags are all words that start with #, e.g. #hashtag.
Expand All @@ -52,7 +53,7 @@ List<TextSegment> parseText(String? text) {
final matches = exp.allMatches(text);

var start = 0;
matches.forEach((match) {
for (var match in matches) {
// text before the keyword
if (match.start > start) {
if (segments.isNotEmpty && segments.last.isText) {
Expand All @@ -72,7 +73,7 @@ List<TextSegment> parseText(String? text) {
final isWord = match.start == 0 ||
[' ', '\n'].contains(text.substring(match.start - 1, start));
if (!isWord) {
return;
continue;
}

final isHashtag = keyword.startsWith('#');
Expand All @@ -83,9 +84,10 @@ List<TextSegment> parseText(String? text) {
}

start = match.end;
});
}

// text after the last keyword or the whole text if it does not contain any keywords
// text after the last keyword or
// the whole text if it does not contain any keywords
if (start < text.length) {
if (segments.isNotEmpty && segments.last.isText) {
segments.last.text += text.substring(start);
Expand Down
4 changes: 3 additions & 1 deletion lib/src/utils/constants.dart
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
const String kRegexLinksAndTags =
r'(?:(?:http|https|ftp|www)\:\/\/)?[a-zA-Z0-9\-\.]+\.[a-zA-Z]{1,}(?::[a-zA-Z0-9]*)?\/?[^\s\n]+|[\w\.-]+@[a-zA-Z\d\.-]+\.[a-zA-Z]{2,}|<<([^<>]+)\|route://member/([a-zA-Z-0-9]+)>>';
r'(?:(?:http|https|ftp|www)\:\/\/)?[a-zA-Z0-9\-\.]+\.[a-zA-Z]{1,}(?::[a-zA-Z0-9]*)?\/?[^\s\n]+|[\w\.-]+@[a-zA-Z\d\.-]+\.[a-zA-Z]{2,}|<<([^<>]+)\|route://member/([a-zA-Z-0-9]+)>>';

const String uiVersion = '1.3.8';
22 changes: 12 additions & 10 deletions lib/src/utils/helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class TaggingHelper {
List<UserTag> userTags = [];
for (final match in matches) {
final String tag = match.group(1)!;
final String mid = match.group(2)!;
//final String mid = match.group(2)!;
final String id = match.group(3)!;
userTags.add(UserTag(userUniqueId: id, name: tag));
}
Expand Down Expand Up @@ -224,21 +224,23 @@ String getFirstValidLinkFromString(String text) {
validLink = validLinks.first;
}
return validLink;
} catch (e) {
} on Exception catch (e, stacktrace) {
debugPrint(e.toString());
debugPrintStack(stackTrace: stacktrace);
return '';
}
}

LinkifyElement? extractLinkAndEmailFromString(String text) {
final urls = linkify(text, linkifiers: [
const EmailLinkifier(),
const UrlLinkifier(),
]);
if (urls.isNotEmpty) {
if (urls.first is EmailElement || urls.first is UrlElement) {
return urls.first;
}
final urls = linkify(text, linkifiers: [
const EmailLinkifier(),
const UrlLinkifier(),
]);
if (urls.isNotEmpty) {
if (urls.first is EmailElement || urls.first is UrlElement) {
return urls.first;
}
}
final links = linkify(text,
options: const LinkifyOptions(
looseUrl: true,
Expand Down
2 changes: 2 additions & 0 deletions lib/src/utils/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import 'package:flutter/material.dart';
import 'package:timeago/timeago.dart';
import 'package:likeminds_feed_ui_fl/src/utils/theme.dart';

const String feedUIVersion = "1.3.9";

extension StringColor on String {
Color? toColor() {
// if (primaryColor != null) {
Expand Down
2 changes: 0 additions & 2 deletions lib/src/widgets/comment/comment_tile.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:likeminds_feed/likeminds_feed.dart';
import 'package:likeminds_feed_ui_fl/packages/expandable_text/expandable_text.dart';
import 'package:likeminds_feed_ui_fl/src/utils/helpers.dart';
import 'package:likeminds_feed_ui_fl/src/utils/theme.dart';
import 'package:likeminds_feed_ui_fl/src/utils/utils.dart';
import 'package:likeminds_feed_ui_fl/src/widgets/common/buttons/text_button.dart';
Expand Down Expand Up @@ -58,7 +57,6 @@ class LMCommentTile extends StatefulWidget {
class _LMCommentTileState extends State<LMCommentTile> {
@override
Widget build(BuildContext context) {
Size screenSize = MediaQuery.of(context).size;
ThemeData theme = Theme.of(context);
return Container(
decoration: BoxDecoration(
Expand Down
2 changes: 0 additions & 2 deletions lib/src/widgets/comment/reply_tile.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:likeminds_feed/likeminds_feed.dart';
import 'package:likeminds_feed_ui_fl/packages/expandable_text/expandable_text.dart';
import 'package:likeminds_feed_ui_fl/src/utils/helpers.dart';
import 'package:likeminds_feed_ui_fl/src/utils/theme.dart';
import 'package:likeminds_feed_ui_fl/src/widgets/common/buttons/text_button.dart';
import 'package:likeminds_feed_ui_fl/src/widgets/common/icon/icon.dart';
Expand Down Expand Up @@ -69,7 +68,6 @@ class _LMReplyTileState extends State<LMReplyTile> {
),

child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Padding(
Expand Down
6 changes: 2 additions & 4 deletions lib/src/widgets/common/buttons/text_button.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:likeminds_feed_ui_fl/likeminds_feed_ui_fl.dart';
import 'package:likeminds_feed_ui_fl/src/utils/utils.dart';

// This widget is used to display a text button
// The [LMTextButton] can be customized by passing in the required parameters
Expand Down Expand Up @@ -35,7 +34,8 @@ class LMTextButton extends StatefulWidget {
final Function() onTap;
// Icon to be displayed in the button if the button is active
final LMIcon? activeIcon;
// Text to be displayed in the button if the button is active, [LMTextView] only
// Text to be displayed in the button if the button is active,
// [LMTextView] only
final LMTextView? activeText;
// Padding of the button, defaults to zero
final EdgeInsets? padding;
Expand Down Expand Up @@ -65,7 +65,6 @@ class _LMTextButtonState extends State<LMTextButton> {
height: widget.height ?? 32,
width: widget.width,
padding: widget.padding ?? EdgeInsets.zero,
clipBehavior: Clip.none,
decoration: BoxDecoration(
color: widget.backgroundColor ?? Colors.transparent,
borderRadius: BorderRadius.circular(widget.borderRadius),
Expand All @@ -74,7 +73,6 @@ class _LMTextButtonState extends State<LMTextButton> {
child: Row(
mainAxisAlignment:
widget.mainAxisAlignment ?? MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
widget.placement == LMIconPlacement.start
? widget.isActive
Expand Down
1 change: 0 additions & 1 deletion lib/src/widgets/common/icon/icon.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:likeminds_feed_ui_fl/src/utils/theme.dart';

enum LMIconType { icon, svg, png }

Expand Down
Loading