1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 04:49:21 +00:00

Start update

This commit is contained in:
Pierre HUBERT 2021-02-07 17:09:08 +01:00
parent df915e1ca3
commit ee6e28426c
39 changed files with 163 additions and 110 deletions

View File

@ -33,7 +33,7 @@ if (keystorePropertiesFile.exists()) {
} }
android { android {
compileSdkVersion 29 compileSdkVersion 30
compileOptions { compileOptions {
@ -50,8 +50,8 @@ android {
defaultConfig { defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "org.communiquons.comunic" applicationId "org.communiquons.comunic"
minSdkVersion 18 minSdkVersion 21
targetSdkVersion 29 targetSdkVersion 30
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View File

@ -62,6 +62,17 @@ class APIHelper {
contentType: v.type, contentType: v.type,
))); )));
} }
// Process picked files
for (final key in request.pickedFiles.keys) {
var v = request.pickedFiles[key];
data.files.add(MapEntry(
key,
MultipartFile.fromBytes(
await v.readAsBytes(),
filename: v.path.split("/").last,
)));
}
} }
// Execute the request // Execute the request

View File

@ -4,8 +4,7 @@ import 'package:comunic/helpers/websocket_helper.dart';
import 'package:comunic/lists/call_members_list.dart'; import 'package:comunic/lists/call_members_list.dart';
import 'package:comunic/models/call_config.dart'; import 'package:comunic/models/call_config.dart';
import 'package:comunic/models/call_member.dart'; import 'package:comunic/models/call_member.dart';
import 'package:flutter_webrtc/rtc_ice_candidate.dart'; import 'package:flutter_webrtc/flutter_webrtc.dart';
import 'package:flutter_webrtc/rtc_session_description.dart';
/// Calls helper /// Calls helper
/// ///

View File

@ -17,7 +17,7 @@ class CommentsHelper {
"content": comment.hasContent ? comment.content : "", "content": comment.hasContent ? comment.content : "",
}); });
if (comment.hasImage) request.addFile("image", comment.image); if (comment.hasImage) request.addPickedFile("image", comment.image);
final response = await request.execWithFiles(); final response = await request.execWithFiles();

View File

@ -336,7 +336,7 @@ class ConversationsHelper {
); );
// Check for image // Check for image
if (message.hasImage) request.addFile("image", message.image); if (message.hasImage) request.addPickedFile("image", message.image);
//Send the message //Send the message
APIResponse response; APIResponse response;

View File

@ -3,8 +3,7 @@ import 'dart:async';
import 'package:comunic/models/comment.dart'; import 'package:comunic/models/comment.dart';
import 'package:comunic/models/conversation_message.dart'; import 'package:comunic/models/conversation_message.dart';
import 'package:event_bus/event_bus.dart'; import 'package:event_bus/event_bus.dart';
import 'package:flutter_webrtc/rtc_ice_candidate.dart'; import 'package:flutter_webrtc/flutter_webrtc.dart';
import 'package:flutter_webrtc/rtc_session_description.dart';
/// Events helper /// Events helper
/// ///

View File

@ -143,7 +143,7 @@ class PostsHelper {
break; break;
case PostKind.IMAGE: case PostKind.IMAGE:
request.addFile("image", post.image); request.addPickedFile("image", post.image);
break; break;
case PostKind.WEB_LINK: case PostKind.WEB_LINK:

View File

@ -1,11 +1,10 @@
import 'dart:io';
import 'package:comunic/enums/user_page_visibility.dart'; import 'package:comunic/enums/user_page_visibility.dart';
import 'package:comunic/models/account_image_settings.dart'; import 'package:comunic/models/account_image_settings.dart';
import 'package:comunic/models/api_request.dart'; import 'package:comunic/models/api_request.dart';
import 'package:comunic/models/general_settings.dart'; import 'package:comunic/models/general_settings.dart';
import 'package:comunic/models/new_emoji.dart'; import 'package:comunic/models/new_emoji.dart';
import 'package:comunic/models/security_settings.dart'; import 'package:comunic/models/security_settings.dart';
import 'package:image_picker/image_picker.dart';
/// Settings helper /// Settings helper
/// ///
@ -92,9 +91,9 @@ class SettingsHelper {
} }
/// Upload a new account image /// Upload a new account image
static Future<bool> uploadAccountImage(File newImage) async => static Future<bool> uploadAccountImage(PickedFile newImage) async =>
(await APIRequest(uri: "settings/upload_account_image", needLogin: true) (await APIRequest(uri: "settings/upload_account_image", needLogin: true)
.addFile("picture", newImage) .addPickedFile("picture", newImage)
.execWithFiles()) .execWithFiles())
.isOK; .isOK;
@ -132,7 +131,7 @@ class SettingsHelper {
uri: "settings/upload_custom_emoji", uri: "settings/upload_custom_emoji",
needLogin: true, needLogin: true,
args: {"shortcut": newEmoji.shortcut}) args: {"shortcut": newEmoji.shortcut})
.addFile("image", newEmoji.image) .addPickedFile("image", newEmoji.image)
.execWithFiles()) .execWithFiles())
.assertOk(); .assertOk();

View File

@ -7,8 +7,7 @@ import 'package:comunic/helpers/events_helper.dart';
import 'package:comunic/models/api_request.dart'; import 'package:comunic/models/api_request.dart';
import 'package:comunic/models/config.dart'; import 'package:comunic/models/config.dart';
import 'package:comunic/models/ws_message.dart'; import 'package:comunic/models/ws_message.dart';
import 'package:flutter_webrtc/rtc_ice_candidate.dart'; import 'package:flutter_webrtc/flutter_webrtc.dart';
import 'package:flutter_webrtc/rtc_session_description.dart';
import 'package:web_socket_channel/web_socket_channel.dart'; import 'package:web_socket_channel/web_socket_channel.dart';
/// User web socket helper /// User web socket helper

View File

@ -3,6 +3,7 @@ import 'dart:io';
import 'package:comunic/helpers/api_helper.dart'; import 'package:comunic/helpers/api_helper.dart';
import 'package:comunic/models/api_response.dart'; import 'package:comunic/models/api_response.dart';
import 'package:http_parser/http_parser.dart'; import 'package:http_parser/http_parser.dart';
import 'package:image_picker/image_picker.dart';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
/// API Request model /// API Request model
@ -28,6 +29,7 @@ class APIRequest {
final bool needLogin; final bool needLogin;
Map<String, String> args; Map<String, String> args;
Map<String, File> files = Map(); Map<String, File> files = Map();
Map<String, PickedFile> pickedFiles = Map();
Map<String, BytesFile> bytesFiles = Map(); Map<String, BytesFile> bytesFiles = Map();
APIRequest({@required this.uri, this.needLogin = false, this.args}) APIRequest({@required this.uri, this.needLogin = false, this.args})
@ -68,6 +70,11 @@ class APIRequest {
return this; return this;
} }
APIRequest addPickedFile(String name, PickedFile file) {
pickedFiles[name] = file;
return this;
}
APIRequest addBytesFile(String name, BytesFile file) { APIRequest addBytesFile(String name, BytesFile file) {
this.bytesFiles[name] = file; this.bytesFiles[name] = file;
return this; return this;

View File

@ -1,5 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_webrtc/media_stream.dart'; import 'package:flutter_webrtc/flutter_webrtc.dart';
/// Single call member information /// Single call member information
/// ///

View File

@ -1,5 +1,4 @@
import 'dart:io'; import 'package:image_picker/image_picker.dart';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
/// New comment information /// New comment information
@ -9,7 +8,7 @@ import 'package:meta/meta.dart';
class NewComment { class NewComment {
final int postID; final int postID;
final String content; final String content;
final File image; final PickedFile image;
const NewComment({ const NewComment({
@required this.postID, @required this.postID,

View File

@ -1,5 +1,4 @@
import 'dart:io'; import 'package:image_picker/image_picker.dart';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
/// New conversation message model /// New conversation message model
@ -11,15 +10,14 @@ import 'package:meta/meta.dart';
class NewConversationMessage { class NewConversationMessage {
final int conversationID; final int conversationID;
final String message; final String message;
final File image; final PickedFile image;
NewConversationMessage({ NewConversationMessage(
@required this.conversationID, {@required this.conversationID, @required this.message, this.image})
@required this.message, : assert(conversationID != null),
this.image
}) : assert(conversationID != null),
assert(image != null || message != null); assert(image != null || message != null);
bool get hasMessage => message != null; bool get hasMessage => message != null;
bool get hasImage => image != null; bool get hasImage => image != null;
} }

View File

@ -1,6 +1,5 @@
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
/// New emoji information /// New emoji information
/// ///
@ -8,7 +7,7 @@ import 'package:flutter/material.dart';
class NewEmoji { class NewEmoji {
final String shortcut; final String shortcut;
final File image; final PickedFile image;
const NewEmoji({ const NewEmoji({
@required this.shortcut, @required this.shortcut,

View File

@ -1,8 +1,7 @@
import 'dart:io';
import 'package:comunic/enums/post_kind.dart'; import 'package:comunic/enums/post_kind.dart';
import 'package:comunic/enums/post_target.dart'; import 'package:comunic/enums/post_target.dart';
import 'package:comunic/enums/post_visibility_level.dart'; import 'package:comunic/enums/post_visibility_level.dart';
import 'package:image_picker/image_picker.dart';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
/// New post information /// New post information
@ -28,7 +27,7 @@ class NewPost {
final int targetID; final int targetID;
final PostVisibilityLevel visibility; final PostVisibilityLevel visibility;
final String content; final String content;
final File image; final PickedFile image;
final String url; final String url;
final List<int> pdf; final List<int> pdf;
final PostKind kind; final PostKind kind;

View File

@ -6,4 +6,4 @@ import 'package:wakelock/wakelock.dart';
/// Interface for requesting device wake locking /// Interface for requesting device wake locking
Future<void> setWakeLock(bool enabled) async => Future<void> setWakeLock(bool enabled) async =>
await Wakelock.toggle(on: enabled); await Wakelock.toggle(enable: enabled);

View File

@ -57,7 +57,7 @@ class _TabletRouteState extends MainController {
Widget _buildLeftPane() => Theme( Widget _buildLeftPane() => Theme(
data: Theme.of(context).copyWith( data: Theme.of(context).copyWith(
textTheme: TextTheme(body1: TextStyle(color: Colors.white)), textTheme: TextTheme(bodyText2: TextStyle(color: Colors.white)),
iconTheme: IconThemeData(color: Colors.white), iconTheme: IconThemeData(color: Colors.white),
), ),
child: Container( child: Container(

View File

@ -74,13 +74,13 @@ class _AccountImageSettingsScreenState
// Upload new account image // Upload new account image
SettingsTile( SettingsTile(
title: tr("Upload an account image"), title: tr("Upload an account image"),
onTap: () => _uploadAccountImage(), onPressed: (_) => _uploadAccountImage(),
), ),
// Generate a random account image // Generate a random account image
SettingsTile( SettingsTile(
title: tr("Generate a random account image"), title: tr("Generate a random account image"),
onTap: () => _generateRandomAccountImage(), onPressed: (_) => _generateRandomAccountImage(),
), ),
]; ];
} }
@ -100,19 +100,19 @@ class _AccountImageSettingsScreenState
// Upload new account image // Upload new account image
SettingsTile( SettingsTile(
title: tr("Upload new account image"), title: tr("Upload new account image"),
onTap: () => _uploadAccountImage(), onPressed: (_) => _uploadAccountImage(),
), ),
// Generate a random account image // Generate a random account image
SettingsTile( SettingsTile(
title: tr("Generate a random account image"), title: tr("Generate a random account image"),
onTap: () => _generateRandomAccountImage(), onPressed: (_) => _generateRandomAccountImage(),
), ),
// Change account image visibility // Change account image visibility
SettingsTile( SettingsTile(
title: tr("Change account image visibility"), title: tr("Change account image visibility"),
onTap: () => _chooseAccountImageVisibility(), onPressed: (_) => _chooseAccountImageVisibility(),
subtitle: tr("Current level: %level%", args: { subtitle: tr("Current level: %level%", args: {
"level": "level":
_settings.visibility == AccountImageVisibilityLevels.EVERYONE _settings.visibility == AccountImageVisibilityLevels.EVERYONE
@ -126,7 +126,7 @@ class _AccountImageSettingsScreenState
// Delete account image // Delete account image
SettingsTile( SettingsTile(
title: tr("Delete account image"), title: tr("Delete account image"),
onTap: () => _deleteAccountImage(), onPressed: (_) => _deleteAccountImage(),
), ),
]; ];
} }

View File

@ -24,7 +24,7 @@ class _AccountPrivacySettingsState extends State<AccountPrivacySettings> {
title: tr("Delete your account"), title: tr("Delete your account"),
subtitle: subtitle:
tr("Permanently delete your account and all data related to it."), tr("Permanently delete your account and all data related to it."),
onTap: _deleteAccount, onPressed: (_)=>_deleteAccount,
) )
]) ])
]); ]);

View File

@ -30,19 +30,19 @@ class _AccountSecuritySettingsScreenState
tiles: [ tiles: [
SettingsTile( SettingsTile(
title: tr("Change password"), title: tr("Change password"),
onTap: _changePassword, onPressed: (_) => _changePassword,
), ),
SettingsTile( SettingsTile(
title: tr("Change your security questions"), title: tr("Change your security questions"),
subtitle: tr( subtitle: tr(
"Your security questions can be used to recover an access to your account when you loose your password..."), "Your security questions can be used to recover an access to your account when you loose your password..."),
onTap: _changeSecurityQuestions, onPressed: (_) => _changeSecurityQuestions,
), ),
SettingsTile( SettingsTile(
title: tr("Disconnect all your devices"), title: tr("Disconnect all your devices"),
subtitle: tr( subtitle: tr(
"Disconnect all your devices from Comunic, including the current one. Use this option if one of the device you use for Comunic was stolen."), "Disconnect all your devices from Comunic, including the current one. Use this option if one of the device you use for Comunic was stolen."),
onTap: _disconnectAllDevices, onPressed: (_) => _disconnectAllDevices,
), ),
], ],
) )

View File

@ -152,7 +152,7 @@ class __AccountSettingsBodyState extends State<_AccountSettingsBody> {
title: f.title, title: f.title,
leading: Icon(f.icon), leading: Icon(f.icon),
subtitle: f.subtitle, subtitle: f.subtitle,
onTap: () => _openSectionsAsNewRoute(f), onPressed: (_) => _openSectionsAsNewRoute(f),
)) ))
.toList(), .toList(),
) )

View File

@ -58,7 +58,7 @@ class _ApplicationSettingsState extends State<ApplicationSettings> {
SettingsTile( SettingsTile(
title: tr("About this application"), title: tr("About this application"),
subtitle: tr("Learn more about us"), subtitle: tr("Learn more about us"),
onTap: () => showAboutAppDialog(context), onPressed: (_) => showAboutAppDialog(context),
) )
], ],
); );

View File

@ -1,5 +1,3 @@
import 'dart:io';
import 'package:comunic/helpers/settings_helper.dart'; import 'package:comunic/helpers/settings_helper.dart';
import 'package:comunic/helpers/users_helper.dart'; import 'package:comunic/helpers/users_helper.dart';
import 'package:comunic/lists/custom_emojies_list.dart'; import 'package:comunic/lists/custom_emojies_list.dart';
@ -14,6 +12,7 @@ import 'package:comunic/utils/input_utils.dart';
import 'package:comunic/utils/intl_utils.dart'; import 'package:comunic/utils/intl_utils.dart';
import 'package:comunic/utils/ui_utils.dart'; import 'package:comunic/utils/ui_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
/// Emojies account settings /// Emojies account settings
/// ///
@ -137,7 +136,7 @@ class _NewCustomEmojiDialog extends StatefulWidget {
class _NewCustomEmojiDialogState extends State<_NewCustomEmojiDialog> { class _NewCustomEmojiDialogState extends State<_NewCustomEmojiDialog> {
final _controller = TextEditingController(); final _controller = TextEditingController();
File _file; PickedFile _file;
bool get _hasImage => _file != null; bool get _hasImage => _file != null;

View File

@ -198,7 +198,7 @@ class _GeneralAccountSettingsScreenState
SettingsTile( SettingsTile(
title: tr("Virtual directory (optional)"), title: tr("Virtual directory (optional)"),
subtitle: _settings.virtualDirectory, subtitle: _settings.virtualDirectory,
onTap: () async { onPressed: (_) async {
final dir = await showVirtualDirectoryDialog( final dir = await showVirtualDirectoryDialog(
context: context, context: context,
initialDirectory: _settings.virtualDirectory, initialDirectory: _settings.virtualDirectory,

View File

@ -17,8 +17,7 @@ import 'package:comunic/utils/account_utils.dart';
import 'package:comunic/utils/intl_utils.dart'; import 'package:comunic/utils/intl_utils.dart';
import 'package:comunic/utils/ui_utils.dart'; import 'package:comunic/utils/ui_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_webrtc/rtc_peerconnection.dart'; import 'package:flutter_webrtc/flutter_webrtc.dart';
import 'package:flutter_webrtc/webrtc.dart';
/// Call screen /// Call screen
/// ///
@ -216,7 +215,7 @@ class _CallScreenState extends SafeState<CallScreen> {
await _stopStreaming(); await _stopStreaming();
// Request user media // Request user media
_localStream = await navigator.getUserMedia({ _localStream = await navigator.mediaDevices.getUserMedia({
"audio": true, "audio": true,
"video": !includeVideo "video": !includeVideo
? false ? false
@ -451,7 +450,7 @@ class _CallScreenState extends SafeState<CallScreen> {
switch (option) { switch (option) {
// Switch camera // Switch camera
case _PopupMenuOption.SWITCH_CAMERA: case _PopupMenuOption.SWITCH_CAMERA:
await _localStream.getVideoTracks()[0].switchCamera(); await Helper.switchCamera(_localStream.getVideoTracks()[0]);
break; break;
// Stop streaming // Stop streaming

View File

@ -112,7 +112,7 @@ class _GroupSettingsScreenState extends SafeState<GroupSettingsScreen> {
SettingsTile( SettingsTile(
title: tr("Virtual directory (optional)"), title: tr("Virtual directory (optional)"),
subtitle: _groupSettings.virtualDirectory, subtitle: _groupSettings.virtualDirectory,
onTap: () async { onPressed: (_) async {
final newDir = await showVirtualDirectoryDialog( final newDir = await showVirtualDirectoryDialog(
context: context, context: context,
initialDirectory: _groupSettings.virtualDirectory, initialDirectory: _groupSettings.virtualDirectory,
@ -257,19 +257,19 @@ class _GroupSettingsScreenState extends SafeState<GroupSettingsScreen> {
// Upload a new logo // Upload a new logo
SettingsTile( SettingsTile(
title: tr("Upload a new logo"), title: tr("Upload a new logo"),
onTap: _uploadNewLogo, onPressed: (_) => _uploadNewLogo,
), ),
// Generate a new random logo // Generate a new random logo
SettingsTile( SettingsTile(
title: tr("Generate a new random logo"), title: tr("Generate a new random logo"),
onTap: _generateRandomLogo, onPressed: (_) => _generateRandomLogo,
), ),
// Delete current logo // Delete current logo
SettingsTile( SettingsTile(
title: tr("Delete logo"), title: tr("Delete logo"),
onTap: _deleteLogo, onPressed: (_) => _deleteLogo,
), ),
], ],
); );
@ -279,7 +279,7 @@ class _GroupSettingsScreenState extends SafeState<GroupSettingsScreen> {
void _uploadNewLogo() async { void _uploadNewLogo() async {
try { try {
final logo = await pickImage(context); final logo = await pickImage(context);
final bytes = logo.readAsBytesSync(); final bytes = await logo.readAsBytes();
await _doUploadLogo(bytes); await _doUploadLogo(bytes);
} catch (e, stack) { } catch (e, stack) {
print("Could not upload new logo! $e\n$stack"); print("Could not upload new logo! $e\n$stack");
@ -326,7 +326,7 @@ class _GroupSettingsScreenState extends SafeState<GroupSettingsScreen> {
tiles: [ tiles: [
SettingsTile( SettingsTile(
title: tr("Delete group"), title: tr("Delete group"),
onTap: _deleteGroup, onPressed: (_) => _deleteGroup,
), ),
], ],
); );

View File

@ -76,7 +76,7 @@ class _UnreadConversationsScreenState
leading: AccountImageWidget(user: user), leading: AccountImageWidget(user: user),
title: Text(user.displayName), title: Text(user.displayName),
subtitle: RichText( subtitle: RichText(
text: TextSpan(style: Theme.of(context).textTheme.body1, children: [ text: TextSpan(style: Theme.of(context).textTheme.bodyText2, children: [
TextSpan(text: conv.convName.isNotEmpty ? conv.convName + "\n" : ""), TextSpan(text: conv.convName.isNotEmpty ? conv.convName + "\n" : ""),
TextSpan( TextSpan(
text: conv.message, text: conv.message,

View File

@ -1,4 +1,3 @@
import 'dart:io';
import 'dart:math'; import 'dart:math';
import 'package:comunic/enums/post_kind.dart'; import 'package:comunic/enums/post_kind.dart';
@ -26,6 +25,7 @@ import 'package:comunic/utils/navigation_utils.dart';
import 'package:comunic/utils/post_utils.dart'; import 'package:comunic/utils/post_utils.dart';
import 'package:comunic/utils/ui_utils.dart'; import 'package:comunic/utils/ui_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
/// Single posts tile /// Single posts tile
@ -76,7 +76,7 @@ class _PostTileState extends State<PostTile> {
// Class members // Class members
TextEditingController _commentController = TextEditingController(); TextEditingController _commentController = TextEditingController();
File _commentImage; PickedFile _commentImage;
bool _submitting = false; bool _submitting = false;
int _maxNumberOfCommentToShow = 10; int _maxNumberOfCommentToShow = 10;

View File

@ -36,7 +36,7 @@ class LoginScaffold extends StatelessWidget {
), ),
scaffoldBackgroundColor: Colors.indigo.shade900, scaffoldBackgroundColor: Colors.indigo.shade900,
textTheme: TextTheme( textTheme: TextTheme(
body1: TextStyle(color: Colors.white), bodyText2: TextStyle(color: Colors.white),
button: TextStyle(color: Colors.white), button: TextStyle(color: Colors.white),
), ),
), ),

View File

@ -1,4 +1,3 @@
import 'dart:io';
import 'package:comunic/enums/post_kind.dart'; import 'package:comunic/enums/post_kind.dart';
import 'package:comunic/enums/post_target.dart'; import 'package:comunic/enums/post_target.dart';
@ -15,6 +14,7 @@ import 'package:comunic/utils/post_utils.dart';
import 'package:comunic/utils/ui_utils.dart'; import 'package:comunic/utils/ui_utils.dart';
import 'package:file_picker_cross/file_picker_cross.dart'; import 'package:file_picker_cross/file_picker_cross.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
/// Widget that allows to create posts /// Widget that allows to create posts
/// ///
@ -51,7 +51,7 @@ class _PostCreateFormWidgetState extends State<PostCreateFormWidget> {
bool _isCreating = false; bool _isCreating = false;
final TextEditingController _postTextController = TextEditingController(); final TextEditingController _postTextController = TextEditingController();
PostVisibilityLevel _postVisibilityLevel; PostVisibilityLevel _postVisibilityLevel;
File _postImage; PickedFile _postImage;
String _postURL; String _postURL;
List<int> _postPDF; List<int> _postPDF;
DateTime _timeEnd; DateTime _timeEnd;
@ -278,13 +278,11 @@ class _PostCreateFormWidgetState extends State<PostCreateFormWidget> {
/// Pick a PDF for the new post /// Pick a PDF for the new post
Future<void> _pickPDFForPost() async { Future<void> _pickPDFForPost() async {
try { try {
final picker = FilePickerCross( final picker = await FilePickerCross.importFromStorage(
type: FileTypeCross.custom, type: FileTypeCross.custom,
fileExtension: "pdf", fileExtension: "pdf",
); );
if (!await picker.pick()) return;
_resetPostSelection(); _resetPostSelection();
setState(() { setState(() {
@ -416,7 +414,9 @@ class _PostOptionWidget extends StatelessWidget {
onPressed: onTap, onPressed: onTap,
color: hasCustomColor color: hasCustomColor
? customColor ? customColor
: selected ? _ActiveButtonsColor : _InactiveButtonsColor, : selected
? _ActiveButtonsColor
: _InactiveButtonsColor,
); );
} }
} }

View File

@ -28,7 +28,7 @@ class MultiChoicesSettingsTile<T> extends SettingsTile {
return SettingsTile( return SettingsTile(
title: title, title: title,
subtitle: choices.firstWhere((f) => f.id == currentValue).title, subtitle: choices.firstWhere((f) => f.id == currentValue).title,
onTap: () => _changeValue(context), onPressed: (_) => _changeValue(context),
); );
} }

View File

@ -40,7 +40,7 @@ class TextEditSettingsTile extends SettingsTile {
return SettingsTile( return SettingsTile(
title: title, title: title,
subtitle: currValue, subtitle: currValue,
onTap: readOnly ? null : () => _changeValue(context), onPressed: (_)=>readOnly ? null : () => _changeValue(context),
); );
} }

View File

@ -44,7 +44,7 @@ class ConversationWindowContainer extends StatelessWidget {
appBar: AppBarWrapper( appBar: AppBarWrapper(
height: 40, height: 40,
appBar: AppBar( appBar: AppBar(
textTheme: TextTheme(title: TextStyle(fontSize: 15)), textTheme: TextTheme(headline6: TextStyle(fontSize: 15)),
backgroundColor: appBarBgColor, backgroundColor: appBarBgColor,
leading: icon, leading: icon,
title: GestureDetector(child: title, onTap: onToggleCollapse), title: GestureDetector(child: title, onTap: onToggleCollapse),

View File

@ -33,7 +33,7 @@ class TextWidget extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (this.content.isNull || this.content.isEmpty) return Text(""); if (this.content.isNull || this.content.isEmpty) return Text("");
var usedStyle = style == null ? Theme.of(context).textTheme.body1 : style; var usedStyle = style == null ? Theme.of(context).textTheme.bodyText2 : style;
var content = this.content.parsedString; var content = this.content.parsedString;

View File

@ -32,7 +32,7 @@ class BBCodeParsedWidget extends StatelessWidget {
} }
/// Initialize parsing /// Initialize parsing
static _Element _parse(String text, {_ElementStyle style}) { static _Element _parse(String text) {
try { try {
return _parseRecur( return _parseRecur(
text: text, text: text,
@ -213,7 +213,7 @@ class _ElementStyle {
/// Generate corresponding TextStyle /// Generate corresponding TextStyle
TextStyle toTextStyle(BuildContext context) { TextStyle toTextStyle(BuildContext context) {
return Theme.of(context).textTheme.body1.copyWith( return Theme.of(context).textTheme.bodyText2.copyWith(
decoration: decoration, decoration: decoration,
fontWeight: fontWeight, fontWeight: fontWeight,
fontStyle: fontStyle, fontStyle: fontStyle,

View File

@ -1,5 +1,3 @@
import 'dart:io';
import 'package:comunic/utils/intl_utils.dart'; import 'package:comunic/utils/intl_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
@ -13,7 +11,7 @@ enum _ChooseImageSource { GALLERY, CAMERA }
/// Ask the user to choose an image, either from the gallery or using the camera /// Ask the user to choose an image, either from the gallery or using the camera
/// ///
/// Returns null in case of failure /// Returns null in case of failure
Future<File> pickImage(BuildContext context) async { Future<PickedFile> pickImage(BuildContext context) async {
/// First, we ask the user to choose between image picker and camera /// First, we ask the user to choose between image picker and camera
final result = await showDialog<_ChooseImageSource>( final result = await showDialog<_ChooseImageSource>(
context: context, context: context,
@ -42,8 +40,7 @@ Future<File> pickImage(BuildContext context) async {
); );
if (result == null) return null; if (result == null) return null;
return await ImagePicker().getImage(
return await ImagePicker.pickImage(
source: result == _ChooseImageSource.CAMERA source: result == _ChooseImageSource.CAMERA
? ImageSource.camera ? ImageSource.camera
: ImageSource.gallery); : ImageSource.gallery);

View File

@ -39,8 +39,8 @@ Widget buildErrorCard(String message,
if (hide) return Container(); if (hide) return Container();
return Theme( return Theme(
data: data: ThemeData(
ThemeData(textTheme: TextTheme(body1: TextStyle(color: Colors.white))), textTheme: TextTheme(bodyText2: TextStyle(color: Colors.white))),
child: Card( child: Card(
elevation: 2.0, elevation: 2.0,
color: Colors.red, color: Colors.red,

View File

@ -70,7 +70,7 @@ packages:
name: connectivity name: connectivity
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.9+5" version: "2.0.2"
connectivity_for_web: connectivity_for_web:
dependency: transitive dependency: transitive
description: description:
@ -127,6 +127,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.10" version: "3.0.10"
disk_space:
dependency: transitive
description:
name: disk_space
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.3"
event_bus: event_bus:
dependency: "direct main" dependency: "direct main"
description: description:
@ -168,21 +175,14 @@ packages:
name: file_picker name: file_picker
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.13.3" version: "2.1.6"
file_picker_cross: file_picker_cross:
dependency: "direct main" dependency: "direct main"
description: description:
name: file_picker_cross name: file_picker_cross
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0" version: "4.2.8"
file_picker_platform_interface:
dependency: transitive
description:
name: file_picker_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@ -232,7 +232,7 @@ packages:
name: flutter_webrtc name: flutter_webrtc
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.8" version: "0.5.8"
html: html:
dependency: "direct main" dependency: "direct main"
description: description:
@ -282,6 +282,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.6" version: "1.1.6"
import_js_library:
dependency: transitive
description:
name: import_js_library
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
intl: intl:
dependency: "direct main" dependency: "direct main"
description: description:
@ -289,6 +296,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.16.1" version: "0.16.1"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.2"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
@ -303,6 +317,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0-nullsafety.3" version: "1.3.0-nullsafety.3"
mime:
dependency: transitive
description:
name: mime
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.7"
octo_image: octo_image:
dependency: transitive dependency: transitive
description: description:
@ -310,6 +331,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.3.0" version: "0.3.0"
package_info:
dependency: transitive
description:
name: package_info
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.3+4"
path: path:
dependency: transitive dependency: transitive
description: description:
@ -372,14 +400,14 @@ packages:
name: photo_view name: photo_view
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.9.2" version: "0.10.3"
pie_chart: pie_chart:
dependency: "direct main" dependency: "direct main"
description: description:
name: pie_chart name: pie_chart
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.1.1" version: "4.0.1"
platform: platform:
dependency: transitive dependency: transitive
description: description:
@ -421,7 +449,14 @@ packages:
name: settings_ui name: settings_ui
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.3.0" version: "0.5.0"
share:
dependency: transitive
description:
name: share
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.5+4"
shared_preferences: shared_preferences:
dependency: "direct main" dependency: "direct main"
description: description:
@ -601,7 +636,21 @@ packages:
name: wakelock name: wakelock
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.4+2" version: "0.2.1+1"
wakelock_platform_interface:
dependency: transitive
description:
name: wakelock_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0+1"
wakelock_web:
dependency: transitive
description:
name: wakelock_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0+3"
web_socket_channel: web_socket_channel:
dependency: "direct main" dependency: "direct main"
description: description:

View File

@ -35,7 +35,7 @@ dependencies:
# The HTTP client is used to make requests on the Comunic API # The HTTP client is used to make requests on the Comunic API
dio: ^3.0.9 dio: ^3.0.9
http_parser: ^3.1.3 http_parser: ^3.1.4
# This plugins allows to load remote images # This plugins allows to load remote images
cached_network_image: ^2.0.0 cached_network_image: ^2.0.0
@ -47,7 +47,7 @@ dependencies:
html: ^0.14.0+3 html: ^0.14.0+3
# Module that display the charts for the surveys # Module that display the charts for the surveys
pie_chart: ^3.1.1 pie_chart: ^4.0.1
# Get current system language # Get current system language
intl: ^0.16.1 intl: ^0.16.1
@ -56,7 +56,7 @@ dependencies:
flutter_emoji: ^2.2.1+1 flutter_emoji: ^2.2.1+1
# Build settings UI # Build settings UI
settings_ui: ^0.3.0 settings_ui: ^0.5.0
# Generate identicons # Generate identicons
identicon: ^0.1.1 identicon: ^0.1.1
@ -65,10 +65,10 @@ dependencies:
random_string: ^2.0.1 random_string: ^2.0.1
# Display zoomable images # Display zoomable images
photo_view: ^0.9.2 photo_view: ^0.10.3
# Check Internet connection # Check Internet connection
connectivity: ^0.4.8+2 connectivity: ^2.0.2
# Establish WebSocket connections # Establish WebSocket connections
web_socket_channel: ^1.1.0 web_socket_channel: ^1.1.0
@ -77,13 +77,13 @@ dependencies:
event_bus: ^1.1.1 event_bus: ^1.1.1
# WebRTC calls # WebRTC calls
flutter_webrtc: ^0.2.7 flutter_webrtc: ^0.5.8
# Prevent phone from auto-locking during calls # Prevent phone from auto-locking during calls
wakelock: ^0.1.4+1 wakelock: ^0.2.1+1
# Pick any kind of file # Pick any kind of file
file_picker_cross: ^2.0.0 file_picker_cross: ^4.2.8
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: