Compare commits

..

No commits in common. "859bbd09e0da2a1dfc7d54260ec0146bcec7efd7" and "9c3d181deb49d5bb92412293837b2e81372532b2" have entirely different histories.

8 changed files with 61 additions and 86 deletions

View File

@ -29,8 +29,6 @@ abstract class PlatformInfo {
static bool get canRateTheApp => isIOS || isMacOS; static bool get canRateTheApp => isIOS || isMacOS;
static bool get canCropImage => isIOS || isAndroid || isWeb;
static bool get canRecord => (isMobile || isMacOS); static bool get canRecord => (isMobile || isMacOS);
static bool get canPushNotification => isAndroid || isIOS || isMacOS; static bool get canPushNotification => isAndroid || isIOS || isMacOS;

View File

@ -1,3 +1,5 @@
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_animate/flutter_animate.dart'; import 'package:flutter_animate/flutter_animate.dart';
import 'package:gap/gap.dart'; import 'package:gap/gap.dart';
@ -7,7 +9,6 @@ import 'package:image_picker/image_picker.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:solian/exts.dart'; import 'package:solian/exts.dart';
import 'package:solian/models/attachment.dart'; import 'package:solian/models/attachment.dart';
import 'package:solian/platform.dart';
import 'package:solian/providers/auth.dart'; import 'package:solian/providers/auth.dart';
import 'package:solian/providers/content/attachment.dart'; import 'package:solian/providers/content/attachment.dart';
import 'package:solian/services.dart'; import 'package:solian/services.dart';
@ -76,42 +77,36 @@ class _PersonalizeScreenState extends State<PersonalizeScreen> {
final AuthProvider auth = Get.find(); final AuthProvider auth = Get.find();
if (auth.isAuthorized.isFalse) return; if (auth.isAuthorized.isFalse) return;
XFile file;
final image = await _imagePicker.pickImage(source: ImageSource.gallery); final image = await _imagePicker.pickImage(source: ImageSource.gallery);
if (image == null) return; if (image == null) return;
if (PlatformInfo.canCropImage) { CroppedFile? croppedFile = await ImageCropper().cropImage(
CroppedFile? croppedFile = await ImageCropper().cropImage( sourcePath: image.path,
sourcePath: image.path, uiSettings: [
uiSettings: [ AndroidUiSettings(
AndroidUiSettings( toolbarTitle: 'cropImage'.tr,
toolbarTitle: 'cropImage'.tr, toolbarColor: Theme.of(context).colorScheme.primary,
toolbarColor: Theme.of(context).colorScheme.primary, toolbarWidgetColor: Theme.of(context).colorScheme.onPrimary,
toolbarWidgetColor: Theme.of(context).colorScheme.onPrimary, aspectRatioPresets: [
aspectRatioPresets: [ if (position == 'avatar') CropAspectRatioPreset.square,
if (position == 'avatar') CropAspectRatioPreset.square, if (position == 'banner') _BannerCropAspectRatioPreset(),
if (position == 'banner') _BannerCropAspectRatioPreset(), ],
], ),
), IOSUiSettings(
IOSUiSettings( title: 'cropImage'.tr,
title: 'cropImage'.tr, aspectRatioPresets: [
aspectRatioPresets: [ if (position == 'avatar') CropAspectRatioPreset.square,
if (position == 'avatar') CropAspectRatioPreset.square, if (position == 'banner') _BannerCropAspectRatioPreset(),
if (position == 'banner') _BannerCropAspectRatioPreset(), ],
], ),
), WebUiSettings(
WebUiSettings( context: context,
context: context, ),
), ],
], );
);
if (croppedFile == null) return; if (croppedFile == null) return;
file = XFile(croppedFile.path); final file = File(croppedFile.path);
} else {
file = XFile(image.path);
}
setState(() => _isBusy = true); setState(() => _isBusy = true);

View File

@ -289,7 +289,7 @@ class _ChatListState extends State<ChatList> {
..._realmChannels.values.expand((x) => x), ..._realmChannels.values.expand((x) => x),
]), ]),
selfId: selfId, selfId: selfId,
useReplace: AppTheme.isLargeScreen(context), useReplace: false,
), ),
), ),
RefreshIndicator( RefreshIndicator(
@ -297,7 +297,7 @@ class _ChatListState extends State<ChatList> {
child: ChannelListWidget( child: ChannelListWidget(
channels: _directChannels, channels: _directChannels,
selfId: selfId, selfId: selfId,
useReplace: AppTheme.isLargeScreen(context), useReplace: false,
), ),
), ),
...realms.availableRealms.map( ...realms.availableRealms.map(
@ -306,7 +306,7 @@ class _ChatListState extends State<ChatList> {
child: ChannelListWidget( child: ChannelListWidget(
channels: _realmChannels[x.alias] ?? [], channels: _realmChannels[x.alias] ?? [],
selfId: selfId, selfId: selfId,
useReplace: AppTheme.isLargeScreen(context), useReplace: false,
), ),
), ),
), ),

View File

@ -1,3 +1,5 @@
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_animate/flutter_animate.dart'; import 'package:flutter_animate/flutter_animate.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -6,7 +8,6 @@ import 'package:image_picker/image_picker.dart';
import 'package:solian/exts.dart'; import 'package:solian/exts.dart';
import 'package:solian/models/attachment.dart'; import 'package:solian/models/attachment.dart';
import 'package:solian/models/realm.dart'; import 'package:solian/models/realm.dart';
import 'package:solian/platform.dart';
import 'package:solian/providers/auth.dart'; import 'package:solian/providers/auth.dart';
import 'package:solian/providers/content/attachment.dart'; import 'package:solian/providers/content/attachment.dart';
import 'package:solian/router.dart'; import 'package:solian/router.dart';
@ -83,42 +84,36 @@ class _RealmOrganizeScreenState extends State<RealmOrganizeScreen> {
final AuthProvider auth = Get.find(); final AuthProvider auth = Get.find();
if (auth.isAuthorized.isFalse) return; if (auth.isAuthorized.isFalse) return;
XFile file;
final image = await _imagePicker.pickImage(source: ImageSource.gallery); final image = await _imagePicker.pickImage(source: ImageSource.gallery);
if (image == null) return; if (image == null) return;
if (PlatformInfo.canCropImage) { CroppedFile? croppedFile = await ImageCropper().cropImage(
CroppedFile? croppedFile = await ImageCropper().cropImage( sourcePath: image.path,
sourcePath: image.path, uiSettings: [
uiSettings: [ AndroidUiSettings(
AndroidUiSettings( toolbarTitle: 'cropImage'.tr,
toolbarTitle: 'cropImage'.tr, toolbarColor: Theme.of(context).colorScheme.primary,
toolbarColor: Theme.of(context).colorScheme.primary, toolbarWidgetColor: Theme.of(context).colorScheme.onPrimary,
toolbarWidgetColor: Theme.of(context).colorScheme.onPrimary, aspectRatioPresets: [
aspectRatioPresets: [ if (position == 'avatar') CropAspectRatioPreset.square,
if (position == 'avatar') CropAspectRatioPreset.square, if (position == 'banner') _BannerCropAspectRatioPreset(),
if (position == 'banner') _BannerCropAspectRatioPreset(), ],
], ),
), IOSUiSettings(
IOSUiSettings( title: 'cropImage'.tr,
title: 'cropImage'.tr, aspectRatioPresets: [
aspectRatioPresets: [ if (position == 'avatar') CropAspectRatioPreset.square,
if (position == 'avatar') CropAspectRatioPreset.square, if (position == 'banner') _BannerCropAspectRatioPreset(),
if (position == 'banner') _BannerCropAspectRatioPreset(), ],
], ),
), WebUiSettings(
WebUiSettings( context: context,
context: context, ),
), ],
], );
);
if (croppedFile == null) return; if (croppedFile == null) return;
file = XFile(croppedFile.path); final file = File(croppedFile.path);
} else {
file = XFile(image.path);
}
setState(() => _isBusy = true); setState(() => _isBusy = true);

View File

@ -396,8 +396,7 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
), ),
if (!element.isCompleted && if (!element.isCompleted &&
element.error == null && element.error == null &&
canBeCrop && canBeCrop)
PlatformInfo.canCropImage)
Obx( Obx(
() => IconButton( () => IconButton(
color: Colors.teal, color: Colors.teal,

View File

@ -1,7 +1,4 @@
import 'dart:math';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:solian/router.dart'; import 'package:solian/router.dart';
import 'package:solian/widgets/navigation/app_navigation.dart'; import 'package:solian/widgets/navigation/app_navigation.dart';
@ -57,9 +54,6 @@ class _AppNavigationRailState extends State<AppNavigationRail> {
setState(() => _currentIndex = idx); setState(() => _currentIndex = idx);
AppRouter.instance.goNamed(AppNavigation.destinations[idx].page); AppRouter.instance.goNamed(AppNavigation.destinations[idx].page);
}, },
).paddingOnly(
top: max(16, MediaQuery.of(context).padding.top),
bottom: max(16, MediaQuery.of(context).padding.bottom),
); );
} }
} }

View File

@ -57,11 +57,5 @@
<string>INStartCallIntent</string> <string>INStartCallIntent</string>
<string>INSendMessageIntent</string> <string>INSendMessageIntent</string>
</array> </array>
<key>NSCameraUsageDescription</key>
<string>Allow you take photo/video for your message or post</string>
<key>NSMicrophoneUsageDescription</key>
<string>Allow you record audio for your message or post</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Allow you add photo to your message or post</string>
</dict> </dict>
</plist> </plist>

View File

@ -2,7 +2,7 @@ name: solian
description: "The Solar Network App" description: "The Solar Network App"
publish_to: "none" publish_to: "none"
version: 1.3.0+1 version: 1.2.5+1
environment: environment:
sdk: ">=3.3.4 <4.0.0" sdk: ">=3.3.4 <4.0.0"