mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 12:48:41 +00:00
move files
This commit is contained in:
parent
6a342380b3
commit
8bffd39bc1
14 changed files with 151 additions and 131 deletions
|
|
@ -5,9 +5,9 @@ import 'package:twonly/src/providers/download_change_provider.dart';
|
|||
import 'package:twonly/src/providers/messages_change_provider.dart';
|
||||
import 'package:twonly/src/providers/settings_change_provider.dart';
|
||||
import 'package:twonly/src/utils/storage.dart';
|
||||
import 'package:twonly/src/views/onboarding_view.dart';
|
||||
import 'package:twonly/src/views/onboarding/onboarding_view.dart';
|
||||
import 'package:twonly/src/views/home_view.dart';
|
||||
import 'package:twonly/src/views/register_view.dart';
|
||||
import 'package:twonly/src/views/onboarding/register_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:twonly/src/components/image_editor/data/layer.dart';
|
||||
import 'package:twonly/src/views/share_image_editor_view.dart';
|
||||
import 'package:twonly/src/views/camera_to_share/share_image_editor_view.dart';
|
||||
|
||||
/// Text layer
|
||||
class TextLayer extends StatefulWidget {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:camerawesome/camerawesome_plugin.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:twonly/src/components/media_view_sizing.dart';
|
||||
import 'package:twonly/src/views/permissions_view.dart';
|
||||
import 'package:twonly/src/views/share_image_editor_view.dart';
|
||||
import 'package:twonly/src/components/permissions_view.dart';
|
||||
import 'package:twonly/src/views/camera_to_share/share_image_editor_view.dart';
|
||||
|
||||
class CameraPreviewViewPermission extends StatefulWidget {
|
||||
const CameraPreviewViewPermission({super.key});
|
||||
|
|
@ -46,6 +47,7 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
|
|||
double _lastZoom = 1;
|
||||
double _basePanY = 0;
|
||||
bool sharePreviewIsShown = false;
|
||||
bool isFlashOn = false;
|
||||
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
|
||||
|
||||
@override
|
||||
|
|
@ -125,7 +127,7 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
|
|||
},
|
||||
builder: (cameraState, preview) {
|
||||
return Stack(
|
||||
alignment: Alignment.bottomCenter,
|
||||
//alignment: Alignment.bottomCenter,
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: GestureDetector(
|
||||
|
|
@ -153,6 +155,49 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
|
|||
},
|
||||
),
|
||||
),
|
||||
if (!sharePreviewIsShown)
|
||||
Positioned(
|
||||
right: 0,
|
||||
top: 100,
|
||||
child: Container(
|
||||
alignment: Alignment.bottomCenter,
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
BottomButton(
|
||||
icon: FontAwesomeIcons.repeat,
|
||||
onTap: () async {
|
||||
cameraState.switchCameraSensor(
|
||||
aspectRatio: CameraAspectRatios.ratio_16_9);
|
||||
},
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
BottomButton(
|
||||
icon: FontAwesomeIcons.bolt,
|
||||
color: isFlashOn
|
||||
? const Color.fromARGB(255, 255, 230, 0)
|
||||
: const Color.fromARGB(158, 255, 255, 255),
|
||||
onTap: () async {
|
||||
if (isFlashOn) {
|
||||
cameraState.sensorConfig
|
||||
.setFlashMode(FlashMode.none);
|
||||
isFlashOn = false;
|
||||
} else {
|
||||
cameraState.sensorConfig
|
||||
.setFlashMode(FlashMode.always);
|
||||
isFlashOn = true;
|
||||
}
|
||||
setState(() {});
|
||||
//cameraState.sensorConfig.switchCameraFlash();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (!sharePreviewIsShown)
|
||||
Positioned(
|
||||
bottom: 30,
|
||||
|
|
@ -169,7 +214,6 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
|
|||
cameraState.when(
|
||||
onPhotoMode: (picState) =>
|
||||
picState.takePhoto());
|
||||
// await takePicture();
|
||||
},
|
||||
onLongPress: () async {},
|
||||
child: Align(
|
||||
|
|
@ -3,7 +3,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
|||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:twonly/src/components/media_view_sizing.dart';
|
||||
import 'package:twonly/src/utils/misc.dart';
|
||||
import 'package:twonly/src/views/share_image_view.dart';
|
||||
import 'package:twonly/src/views/camera_to_share/share_image_view.dart';
|
||||
import 'dart:async';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:twonly/src/components/image_editor/data/image_item.dart';
|
||||
|
|
@ -322,10 +322,12 @@ class _ShareImageEditorView extends State<ShareImageEditorView> {
|
|||
class BottomButton extends StatelessWidget {
|
||||
final VoidCallback? onTap, onLongPress;
|
||||
final IconData icon;
|
||||
final Color color;
|
||||
|
||||
const BottomButton({
|
||||
super.key,
|
||||
this.onTap,
|
||||
this.color = Colors.white,
|
||||
this.onLongPress,
|
||||
required this.icon,
|
||||
});
|
||||
|
|
@ -341,7 +343,7 @@ class BottomButton extends StatelessWidget {
|
|||
children: [
|
||||
FaIcon(
|
||||
icon,
|
||||
color: Colors.white,
|
||||
color: color,
|
||||
shadows: ShareImageEditorView.iconShadow,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
|
|
@ -9,7 +9,7 @@ import 'package:twonly/src/model/messages_model.dart';
|
|||
import 'package:twonly/src/providers/api/api.dart';
|
||||
import 'package:twonly/src/providers/download_change_provider.dart';
|
||||
import 'package:twonly/src/providers/messages_change_provider.dart';
|
||||
import 'package:twonly/src/views/media_viewer_view.dart';
|
||||
import 'package:twonly/src/views/chats/media_viewer_view.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
class ChatListEntry extends StatelessWidget {
|
||||
|
|
@ -12,11 +12,11 @@ import 'package:twonly/src/providers/contacts_change_provider.dart';
|
|||
import 'package:twonly/src/providers/download_change_provider.dart';
|
||||
import 'package:twonly/src/providers/messages_change_provider.dart';
|
||||
import 'package:twonly/src/utils/misc.dart';
|
||||
import 'package:twonly/src/views/chat_item_details_view.dart';
|
||||
import 'package:twonly/src/views/chats/chat_item_details_view.dart';
|
||||
import 'package:twonly/src/views/home_view.dart';
|
||||
import 'package:twonly/src/views/media_viewer_view.dart';
|
||||
import 'package:twonly/src/views/chats/media_viewer_view.dart';
|
||||
import 'package:twonly/src/views/profile_view.dart';
|
||||
import 'package:twonly/src/views/search_username_view.dart';
|
||||
import 'package:twonly/src/views/chats/search_username_view.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
89
lib/src/views/chats/media_viewer_view.dart
Normal file
89
lib/src/views/chats/media_viewer_view.dart
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
import 'dart:typed_data';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:twonly/src/components/media_view_sizing.dart';
|
||||
import 'package:twonly/src/model/contacts_model.dart';
|
||||
import 'package:twonly/src/model/messages_model.dart';
|
||||
import 'package:twonly/src/providers/api/api.dart';
|
||||
|
||||
class MediaViewerView extends StatefulWidget {
|
||||
final Contact otherUser;
|
||||
final DbMessage message;
|
||||
const MediaViewerView(this.otherUser, this.message, {super.key});
|
||||
|
||||
@override
|
||||
State<MediaViewerView> createState() => _MediaViewerViewState();
|
||||
}
|
||||
|
||||
class _MediaViewerViewState extends State<MediaViewerView> {
|
||||
Uint8List? _imageByte;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_initAsync();
|
||||
}
|
||||
|
||||
Future _initAsync() async {
|
||||
List<int> token = widget.message.messageContent!.downloadToken!;
|
||||
_imageByte =
|
||||
await getDownloadedMedia(token, widget.message.messageOtherId!);
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (_imageByte == null) return Container();
|
||||
return Scaffold(
|
||||
body: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
MediaViewSizing(Image.memory(
|
||||
_imageByte!,
|
||||
fit: BoxFit.contain,
|
||||
)),
|
||||
Positioned(
|
||||
left: 10,
|
||||
top: 60,
|
||||
child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
IconButton(
|
||||
icon: Icon(Icons.close, size: 30),
|
||||
color: Colors.white,
|
||||
onPressed: () async {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
bottom: 70,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(width: 20),
|
||||
FilledButton.icon(
|
||||
icon: FaIcon(FontAwesomeIcons.solidPaperPlane),
|
||||
onPressed: () async {},
|
||||
style: ButtonStyle(
|
||||
padding: WidgetStateProperty.all<EdgeInsets>(
|
||||
EdgeInsets.symmetric(vertical: 10, horizontal: 30),
|
||||
),
|
||||
),
|
||||
label: Text(
|
||||
"Respond",
|
||||
style: TextStyle(fontSize: 17),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@ import 'package:twonly/src/model/contacts_model.dart';
|
|||
import 'package:twonly/src/model/json/message.dart';
|
||||
import 'package:twonly/src/providers/contacts_change_provider.dart';
|
||||
import 'package:twonly/src/providers/api/api.dart';
|
||||
import 'package:twonly/src/views/register_view.dart';
|
||||
import 'package:twonly/src/views/onboarding/register_view.dart';
|
||||
// ignore: library_prefixes
|
||||
import 'package:twonly/src/utils/signal.dart' as SignalHelper;
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:pie_menu/pie_menu.dart';
|
||||
import 'camera_preview_view.dart';
|
||||
import 'chat_list_view.dart';
|
||||
import 'camera_to_share/camera_preview_view.dart';
|
||||
import 'chats/chat_list_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
Function(int) globalUpdateOfHomeViewPageIndex = (a) {};
|
||||
|
|
@ -68,7 +68,6 @@ class HomeViewState extends State<HomeView> {
|
|||
children: [
|
||||
ChatListView(),
|
||||
CameraPreviewViewPermission(),
|
||||
// ProfileView(settingsController: widget.settingsController)
|
||||
],
|
||||
),
|
||||
bottomNavigationBar: BottomNavigationBar(
|
||||
|
|
|
|||
|
|
@ -1,114 +0,0 @@
|
|||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:twonly/src/model/contacts_model.dart';
|
||||
import 'package:twonly/src/model/messages_model.dart';
|
||||
import 'package:twonly/src/providers/api/api.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
class MediaViewerView extends StatefulWidget {
|
||||
final Contact otherUser;
|
||||
final DbMessage message;
|
||||
const MediaViewerView(this.otherUser, this.message, {super.key});
|
||||
|
||||
@override
|
||||
State<MediaViewerView> createState() => _MediaViewerViewState();
|
||||
}
|
||||
|
||||
class _MediaViewerViewState extends State<MediaViewerView> {
|
||||
Uint8List? _imageByte;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_initAsync();
|
||||
}
|
||||
|
||||
Future _initAsync() async {
|
||||
List<int> token = widget.message.messageContent!.downloadToken!;
|
||||
_imageByte =
|
||||
await getDownloadedMedia(token, widget.message.messageOtherId!);
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
Positioned(
|
||||
top: 0,
|
||||
// bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 50),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(22),
|
||||
child: (_imageByte != null)
|
||||
? Image.memory(
|
||||
_imageByte!,
|
||||
fit: BoxFit.contain,
|
||||
)
|
||||
: Container()),
|
||||
),
|
||||
),
|
||||
_imageByte != null
|
||||
? Positioned(
|
||||
left: 10,
|
||||
top: 60,
|
||||
child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
IconButton(
|
||||
icon: Icon(Icons.close, size: 30),
|
||||
color: Colors.white,
|
||||
onPressed: () async {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
_imageByte != null
|
||||
? Positioned(
|
||||
bottom: 70,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(width: 20),
|
||||
FilledButton.icon(
|
||||
icon: FaIcon(FontAwesomeIcons.solidPaperPlane),
|
||||
onPressed: () async {
|
||||
// Navigator.push(
|
||||
// context,
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) =>
|
||||
// ShareImageView(image: widget.image)),
|
||||
// );
|
||||
},
|
||||
style: ButtonStyle(
|
||||
padding: WidgetStateProperty.all<EdgeInsets>(
|
||||
EdgeInsets.symmetric(vertical: 10, horizontal: 30),
|
||||
),
|
||||
),
|
||||
label: Text(
|
||||
AppLocalizations.of(context)!
|
||||
.shareImagedEditorShareWith,
|
||||
style: TextStyle(fontSize: 17),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue