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
8 changes: 8 additions & 0 deletions asset/lang/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
"tab4":"Style"
},
"subTitle":"Recommended"
},
"social":{
"cancel":"Cancel",
"next":"Next",
"search":"Search",
"findFriends":"Find Friends",
"follow":"Follow",
"following":"Following"
}
}
}
6 changes: 3 additions & 3 deletions lib/core/extension/network_exntension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ extension NetworkTypeExtension on HttpTypes {
String get rawValue {
switch (this) {
case HttpTypes.GET:
return "GET";
return 'GET';
case HttpTypes.POST:
return "POST";
return 'POST';
default:
throw "ERROR TYPE";
throw 'ERROR TYPE';
}
}
}
2 changes: 1 addition & 1 deletion lib/core/init/lang/language_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class LanguageManager {

LanguageManager._init();

final enLocale = Locale("en", "US");
final enLocale = Locale('en', 'US');

List<Locale> get supportedLocales => [enLocale];
}
7 changes: 7 additions & 0 deletions lib/core/init/lang/locale_keys.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ abstract class LocaleKeys {
static const home_build_tabbar = 'home.build.tabbar';
static const home_build_subTitle = 'home.build.subTitle';
static const home_build = 'home.build';
static const home_social_cancel = 'home.social.cancel';
static const home_social_next = 'home.social.next';
static const home_social_search = 'home.social.search';
static const home_social_findFriends = 'home.social.findFriends';
static const home_social_follow = 'home.social.follow';
static const home_social_following = 'home.social.following';
static const home_social = 'home.social';
static const home = 'home';

}
20 changes: 14 additions & 6 deletions lib/core/init/theme/app_theme_light.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import 'light/light_theme_interface.dart';
class AppThemeLight extends AppTheme with ILightTheme {
static AppThemeLight _instance;
static AppThemeLight get instance {
if (_instance == null) _instance = AppThemeLight._init();
return _instance;
return _instance ??= AppThemeLight._init();
}

AppThemeLight._init();

// ThemeData get theme => redTheme;
@override
ThemeData get theme => ThemeData(
fontFamily: ApplicationConstants.FONT_FAMILY,
colorScheme: _appColorScheme,
Expand All @@ -22,11 +22,19 @@ class AppThemeLight extends AppTheme with ILightTheme {
inputDecorationTheme: InputDecorationTheme(
focusColor: Colors.black12,
labelStyle: TextStyle(),
enabledBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.red)),
border: UnderlineInputBorder(borderSide: BorderSide(color: Colors.red)),
focusedBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.red))),
fillColor: Colors.white,
contentPadding: EdgeInsets.zero,
filled: true,
enabledBorder: OutlineInputBorder(borderSide: BorderSide(width: 0.3)),
// border: OutlineInputBorder(borderSide: BorderSide(width: 0.3)),
focusedBorder: OutlineInputBorder()),
scaffoldBackgroundColor: Color(0xfff1f3f8),
floatingActionButtonTheme: ThemeData.light().floatingActionButtonTheme.copyWith(),
buttonTheme: ThemeData.light().buttonTheme.copyWith(
colorScheme: ColorScheme.light(
onError: Color(0xffFF2D55),
),
),
tabBarTheme: tabBarTheme,
);

Expand All @@ -53,7 +61,7 @@ class AppThemeLight extends AppTheme with ILightTheme {
secondary: Colors.green,
secondaryVariant: colorSchemeLight.azure,
surface: Colors.blue, //xx
background: Colors.white,
background: Color(0xfff6f9fc), //xx
error: Colors.red[900],
onPrimary: Colors.greenAccent,
onSecondary: Colors.black, //x
Expand Down
5 changes: 3 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'core/init/navigation/navigation_route.dart';
import 'core/init/navigation/navigation_service.dart';
import 'core/init/notifier/provider_list.dart';
import 'core/init/notifier/theme_notifer.dart';
import 'view/home/build/feed/view/build_feed_view.dart';
import 'view/home/social/view/social_view.dart';

void main() {
WidgetsFlutterBinding.ensureInitialized();
Expand All @@ -24,8 +24,9 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: Provider.of<ThemeNotifier>(context, listen: false).currentTheme,
home: BuildFeedView(),
home: SocialView(),
onGenerateRoute: NavigationRoute.instance.generateRoute,
navigatorKey: NavigationService.instance.navigatorKey,
);
Expand Down
6 changes: 6 additions & 0 deletions lib/view/_product/_model/query/friend_query.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class FriendQuery {
final int limit;
final String q;

FriendQuery({this.limit, this.q});
}
14 changes: 14 additions & 0 deletions lib/view/_product/_model/query/friend_query_enum.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
enum FriendQueryEnum { LIMIT, Q }

extension FriendQueryEnumString on FriendQueryEnum {
String get rawValue {
switch (this) {
case FriendQueryEnum.LIMIT:
return 'limit';
case FriendQueryEnum.Q:
return 'q';
default:
throw Exception('Routes Not FouND');
}
}
}
35 changes: 35 additions & 0 deletions lib/view/_product/_utilty/thorottle_helper.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import 'dart:async';

class ThrottleStringHelper {
String _pastText;

final int _maxTimerValue = 5;
int _timerValue = 0;
ThrottleStringHelper() {
_onSetMaxValue();
}
void onDelayTouch(String text, Function(String text) onComplete) {
_pastText = text;
if (_timerValue == _maxTimerValue) {
Timer.periodic(Duration(milliseconds: 100), (timer) {
_timerValue--;

if (_timerValue == 0) {
onComplete(_pastText);
timer.cancel();
_onSetMaxValue();
}
});
} else {
_onSetMaxNearValue();
}
}

void _onSetMaxValue() {
_timerValue = _maxTimerValue;
}

void _onSetMaxNearValue() {
_timerValue = _maxTimerValue - 1;
}
}
32 changes: 32 additions & 0 deletions lib/view/_product/_widgets/animation/social_card_animation.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import 'package:animations/animations.dart';
import 'package:flutter/material.dart';

import '../../../home/social/model/social_user_model.dart';
import '../../../home/social/view/social_view_detial.dart';

class OpenContainerSocailWrapper extends StatelessWidget {
final ContainerTransitionType _transitionType = ContainerTransitionType.fade;
const OpenContainerSocailWrapper({
this.closedBuilder,
this.onClosed,
this.socialUser,
});

final OpenContainerBuilder closedBuilder;
final ClosedCallback<bool> onClosed;
final SocialUser socialUser;
@override
Widget build(BuildContext context) {
return OpenContainer<bool>(
transitionType: _transitionType,
openBuilder: (BuildContext context, VoidCallback _) {
return SocialUserViewDetail(
socialUser: socialUser,
);
},
onClosed: onClosed,
tappable: false,
closedBuilder: closedBuilder,
);
}
}
29 changes: 29 additions & 0 deletions lib/view/_product/_widgets/list-tile/friend_card.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:kartal/kartal.dart';

import '../../../../core/init/lang/locale_keys.g.dart';
import '../../../home/social/model/social_user_model.dart';

class FriendCard extends StatelessWidget {
final SocialUser user;
final VoidCallback onPressed;

const FriendCard({Key key, this.user, this.onPressed}) : super(key: key);
@override
Widget build(BuildContext context) {
return ListTile(
leading: CircleAvatar(backgroundImage: NetworkImage(user.image)),
title: Text(user.name),
onTap: onPressed,
subtitle: Text(user.company),
trailing: RaisedButton(
child: Text(LocaleKeys.home_social_follow).tr(),
onPressed: () {},
padding: EdgeInsets.zero,
textColor: context.colorScheme.background,
color: context.appTheme.buttonTheme.colorScheme.onError,
),
);
}
}
4 changes: 3 additions & 1 deletion lib/view/_product/enum/network_route_enum.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
enum NetworkRoutes { LOGIN, BUILD_HOME }
enum NetworkRoutes { LOGIN, BUILD_HOME, FRIENDS }

extension NetwrokRoutesString on NetworkRoutes {
String get rawValue {
Expand All @@ -7,6 +7,8 @@ extension NetwrokRoutesString on NetworkRoutes {
return 'login';
case NetworkRoutes.BUILD_HOME:
return 'house';
case NetworkRoutes.FRIENDS:
return 'friends';
default:
throw Exception('Routes Not FouND');
}
Expand Down
2 changes: 2 additions & 0 deletions lib/view/home/build/feed/viewmodel/build_feed_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ part 'build_feed_view_model.g.dart';
class BuildFeedViewModel = _BuildFeedViewModelBase with _$BuildFeedViewModel;

abstract class _BuildFeedViewModelBase with Store, BaseViewModel {
@override
void setContext(BuildContext context) => this.context = context;

GlobalKey<ScaffoldState> scaffoldKey = GlobalKey();
Expand Down Expand Up @@ -40,6 +41,7 @@ abstract class _BuildFeedViewModelBase with Store, BaseViewModel {
@observable
bool isLoaindg = false;

@override
void init() {
helper = DecorationHelper(context: context);
feedService = BuildFeedService(vexanaManager.networkManager, scaffoldKey);
Expand Down
44 changes: 44 additions & 0 deletions lib/view/home/social/model/social_user_model.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:vexana/vexana.dart';

part 'social_user_model.g.dart';

@JsonSerializable()
class SocialUser extends INetworkModel<SocialUser> {
@JsonKey(name: '_id')
String id;
String name;
String company;
String image;

SocialUser({this.name, this.company, this.image});

SocialUser.fromJson(Map<String, dynamic> json) {
id = json['_id'];
name = json['name'];
company = json['company'];
image = json['image'];
}

@override
Map<String, dynamic> toJson() {
return _$SocialUserToJson(this);
}

@override
SocialUser fromJson(Map<String, Object> json) {
return _$SocialUserFromJson(json);
}

@override
bool operator ==(Object o) {
if (identical(this, o)) return true;

return o is SocialUser && o.id == id && o.name == name && o.company == company && o.image == image;
}

@override
int get hashCode {
return id.hashCode ^ name.hashCode ^ company.hashCode ^ image.hashCode;
}
}
23 changes: 23 additions & 0 deletions lib/view/home/social/model/social_user_model.g.dart

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

17 changes: 17 additions & 0 deletions lib/view/home/social/service/ISocialService.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:vexana/vexana.dart';

import '../../../_product/_model/query/friend_query.dart';
import '../model/social_user_model.dart';

abstract class ISocialServiceService {
final INetworkManager manager;
final GlobalKey<ScaffoldState> scaffoldyKey;

ISocialServiceService(this.manager, this.scaffoldyKey);

Future<List<SocialUser>> fetchUserHouseList(FriendQuery query);
Future<List<SocialUser>> fetchUserNameQuery(String text);
Future<SocialUser> fetchUser(id);
}
Loading