Skip to content

Commit

Permalink
Handle the incoming Images, uploading images and no image posts. (#2016)
Browse files Browse the repository at this point in the history
* Made the whole new UI

* drafdt

* Completed the profile page

* Add the report icon for the post

* Corrected the the bottom modal

* Merge conflict resolved

* formating

* formating

* formating

* formating

* Increased the coverage

* Increased the coverage

* Increased the coverage

* f

* removed useless test for now

* flutter version increse

* Upgraded the flutter version

* change flutter v in workflows

* Upgrad the flutter version, and upgraded the flutter lint, and fixed all the lints

* dart format

* Upload and dwonload photos implemented in mobile app

* changes

* formating

* formating

* formating

* default linting error

* default linting error

* chore: Add docs and appropiate tests.

* chore: Some more docs

* Add all docs of all changed files.

* chore: Remove useless package

* Foramtting

* merge

* sdk upgrade

* formatting
  • Loading branch information
Ayush0Chaudhary authored Oct 7, 2023
1 parent 4ac38dc commit fd32403
Show file tree
Hide file tree
Showing 75 changed files with 1,839 additions and 1,345 deletions.
Binary file added assets/images/pfp2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 59 additions & 2 deletions lib/apptheme.dart
Original file line number Diff line number Diff line change
@@ -1,108 +1,165 @@
// ignore_for_file: talawa_api_doc
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
// import 'package:flutter_screenutil/flutter_screenutil.dart';

/// Apptheme class.
///
class AppTheme {
// Text Styles
/// Custom theme for the app.
///
static TextStyle title = const TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
color: blackPrimary,
fontFamily: 'OpenSans',
);

/// Custom theme for the app.
static TextStyle headline1 = const TextStyle(
fontSize: 24,
fontWeight: FontWeight.w600,
color: blackPrimary,
fontFamily: 'OpenSans',
);

/// Custom theme for the app.
static TextStyle headline2 = const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: blackPrimary,
fontFamily: 'OpenSans',
);

/// Custom theme for the app.
static TextStyle headline3 = const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: blackPrimary,
fontFamily: 'OpenSans',
);

/// Custom theme for the app.
static TextStyle headline4 = const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: blackPrimary,
fontFamily: 'OpenSans',
);

/// Custom theme for the app.
static TextStyle headline5 = const TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: blackPrimary,
fontFamily: 'OpenSans',
);

/// Custom theme for the app.
static TextStyle headline6 = const TextStyle(
fontSize: 10,
fontWeight: FontWeight.w600,
color: blackPrimary,
fontFamily: 'OpenSans',
);

/// Custom theme for the app.
static TextStyle subtitle1 = const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: blackSecondary,
fontFamily: 'OpenSans',
);

/// Custom theme for the app.
static TextStyle subtitle2 = const TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
color: blackSecondary,
fontFamily: 'OpenSans',
);

/// Custom theme for the app.
static TextStyle bodyText1 = const TextStyle(
fontSize: 12,
fontWeight: FontWeight.w400,
color: blackSecondary,
fontFamily: 'OpenSans',
);

/// Custom theme for the app.
static TextStyle bodyText2 = const TextStyle(
fontSize: 8,
fontWeight: FontWeight.w400,
color: blackSecondary,
fontFamily: 'OpenSans',
);

/// Custom theme for the app.
static TextStyle bodyText3 = const TextStyle(
fontSize: 10,
fontWeight: FontWeight.w400,
color: blackSecondary,
fontFamily: 'OpenSans',
);

/// Custom theme for the app.
static TextStyle overline = const TextStyle(
fontSize: 6,
fontWeight: FontWeight.w400,
color: blackSecondary,
fontFamily: 'OpenSans',
);

/// Custom theme for the app.
static TextStyle button = const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: primary,
fontFamily: 'OpenSans',
);

// Colors
/// Colors.
///
/// Custom colors for the app.
static const Color primary = Color(0xFFFFC107);

/// Custom colors for the app.
static const Color secondary = Color(0xFF795548);

/// Custom colors for the app.
static const Color tertiary = Color(0xFFA16938);

/// Custom colors for the app.
static const Color white = Color(0xFFFFFFFF);

/// Custom colors for the app.
static const Color red = Color(0xFFEB5757);

/// Custom colors for the app.
static const Color blue = Color(0xFF2196F3);

/// Custom colors for the app.
static const Color yellow = Color(0xffF6BA18);

/// Custom colors for the app.
static const Color green = Color(0xFF2ACC00);

/// Custom colors for the app.
static const Color grey = Color(0xFFD2D2D2);

/// Custom colors for the app.
static const Color lightGrey = Color(0xFFECECEC);

/// Custom colors for the app.
static const Color blackPrimary = Color(0xFF3E3E3E);

/// Custom colors for the app.
static const Color blackSecondary = Color(0xFF636363);

/// Custom colors for the app.
static const Color blackTertiary = Color(0xFFAEAEAE);

/// Custom colors for the app.
static const Color shadow = Color(0x408E8E8E);
}
33 changes: 28 additions & 5 deletions lib/models/organization/org_info.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// ignore_for_file: talawa_api_doc
// ignore_for_file: talawa_good_doc_comments

import 'package:hive/hive.dart';
import 'package:talawa/models/user/user_info.dart';

Expand Down Expand Up @@ -61,29 +58,55 @@ class OrgInfo {
);
}

/// The conventional function to parse json, check flutter docs to know more.
///
///
/// **params**:
/// * `json`: Passing the json to be parsed.
///
/// **returns**:
/// * `List<OrgInfo>`: returning the OrgInfo object containing the json data
List<OrgInfo> fromJsonToList(List<dynamic> json) {
final List<OrgInfo> orgList = [];
json.forEach((element) {
final OrgInfo org = OrgInfo.fromJson(element as Map<String, dynamic>);
orgList.add(org);
if (element is Map<String, dynamic>) {
// print(68);
final OrgInfo org = OrgInfo.fromJson(element);
orgList.add(org);
}
});
return orgList;
}

/// contains the Image url.
@HiveField(0)
String? image;

/// The org id.
@HiveField(1)
String? id;

/// The org name.
@HiveField(2)
String? name;

/// The org admins.
@HiveField(3)
List<User>? admins;

/// The org name.
@HiveField(4)
List<User>? members;

/// The org descriptions.
@HiveField(5)
String? description;

/// The org visibility.
@HiveField(6)
bool? isPublic;

/// The org creatorInfo.
@HiveField(7)
User? creatorInfo;
}
5 changes: 5 additions & 0 deletions lib/models/post/post_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Post {
this.description,
this.createdAt,
this.imageUrl,
this.base64String,
this.videoUrl,
required this.creator,
this.organization,
Expand All @@ -29,6 +30,7 @@ class Post {
description = json['text'] as String?;
createdAt = DateTime.parse(json['createdAt'] as String);
imageUrl = json['imageUrl'] as String?;
base64String = json['base64String'] as String?;
videoUrl = json['videoUrl'] as String?;
creator = json['creator'] != null
? User.fromJson(json['creator'] as Map<String, dynamic>, fromOrg: true)
Expand Down Expand Up @@ -62,6 +64,9 @@ class Post {
/// imageUrl for post.
String? imageUrl;

/// base64String for Image.
String? base64String;

/// videoUrl for post.
String? videoUrl;

Expand Down
4 changes: 2 additions & 2 deletions lib/plugins/talawa_plugin_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import 'package:talawa/services/user_config.dart';
/// TalwaPluginProvider provides ability to implement features as plugins
class TalawaPluginProvider extends StatelessWidget {
const TalawaPluginProvider({
Key? key,
super.key,
@required this.child,
required this.visible,
required this.pluginName,
}) : super(key: key);
});

///child contains the widget for the plugin UI.
final Widget? child;
Expand Down
12 changes: 9 additions & 3 deletions lib/router.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore_for_file: talawa_good_doc_comments
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:talawa/constants/routing_constants.dart';
Expand Down Expand Up @@ -41,10 +40,17 @@ import 'package:talawa/views/pre_auth_screens/set_url.dart';
import 'package:talawa/views/pre_auth_screens/signup_details.dart';
import 'package:talawa/views/pre_auth_screens/waiting_to_join_private_org.dart';

/// The MaterialApp provides us with a property called generateRoute where
/// we can pass in a Function that returns a Route<dynamic> and takes in RouteSettings
/// The MaterialApp provides us with a property called generateRoute where.
///
///
/// we can pass in a Function that returns a Route<dynamic> and takes in RouteSettings
/// Thus for this purpose, we create a function named generateRoute
///
/// **params**:
/// * `settings`: RouteSetting have been passed
///
/// **returns**:
/// * `Route<dynamic>`: Return a Route
Route<dynamic> generateRoute(RouteSettings settings) {
// The settings contains the route information of the requested route.
// It provides two key things to us: the name, and the arguments.
Expand Down
2 changes: 1 addition & 1 deletion lib/services/database_mutation_functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class DataBaseMutationFunctions {
}) {
// if server link is wrong.
if (exception.linkException != null) {
// debugPrint(exception.linkException.toString());
debugPrint(exception.linkException.toString());
if (showSnackBar) {
WidgetsBinding.instance.addPostFrameCallback(
(_) => navigationService.showTalawaErrorSnackBar(
Expand Down
2 changes: 2 additions & 0 deletions lib/utils/post_queries.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class PostQueries {
\$imageUrl: URL
\$videoUrl: URL
\$organizationId: ID!
\$file: String
) {
createPost(
data: {
Expand All @@ -103,6 +104,7 @@ class PostQueries {
videoUrl: \$videoUrl
organizationId: \$organizationId
}
file: \$file
) {
_id
}
Expand Down
Loading

0 comments on commit fd32403

Please sign in to comment.