mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 16:48:41 +00:00
fix #18
This commit is contained in:
parent
34ec8481e3
commit
a0ea74cc87
13 changed files with 182 additions and 168 deletions
|
|
@ -10,6 +10,7 @@ import 'package:logging/logging.dart';
|
|||
import 'package:twonly/src/providers/download_change_provider.dart';
|
||||
import 'package:twonly/src/providers/messages_change_provider.dart';
|
||||
import 'package:twonly/src/providers/contacts_change_provider.dart';
|
||||
import 'package:twonly/src/providers/send_next_media_to.dart';
|
||||
import 'package:twonly/src/providers/settings_change_provider.dart';
|
||||
import 'package:twonly/src/services/notification_service.dart';
|
||||
import 'src/app.dart';
|
||||
|
|
@ -49,6 +50,7 @@ void main() async {
|
|||
ChangeNotifierProvider(create: (_) => MessagesChangeProvider()),
|
||||
ChangeNotifierProvider(create: (_) => DownloadChangeProvider()),
|
||||
ChangeNotifierProvider(create: (_) => ContactChangeProvider()),
|
||||
ChangeNotifierProvider(create: (_) => SendNextMediaTo()),
|
||||
ChangeNotifierProvider(create: (_) => settingsController),
|
||||
],
|
||||
child: MyApp(),
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:pie_menu/pie_menu.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:twonly/src/model/contacts_model.dart';
|
||||
import 'package:twonly/src/providers/send_next_media_to.dart';
|
||||
import 'package:twonly/src/views/chats/chat_item_details_view.dart';
|
||||
import 'package:twonly/src/views/contact/contact_verify_view.dart';
|
||||
import 'package:twonly/src/views/home_view.dart';
|
||||
|
||||
class UserContextMenu extends StatefulWidget {
|
||||
final Widget child;
|
||||
|
|
@ -48,7 +51,10 @@ class _UserContextMenuState extends State<UserContextMenu> {
|
|||
PieAction(
|
||||
tooltip: const Text('Send image'),
|
||||
onSelect: () {
|
||||
print('Send image selected');
|
||||
context
|
||||
.read<SendNextMediaTo>()
|
||||
.updateSendNextMediaTo(widget.user.userId.toInt());
|
||||
globalUpdateOfHomeViewPageIndex(0);
|
||||
},
|
||||
child: const FaIcon(FontAwesomeIcons.camera),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@
|
|||
"protectAsARealTwonly": "Als echtes twonly senden!",
|
||||
"addDrawing": "Zeichnung",
|
||||
"addEmoji": "Emoji",
|
||||
"toogleFlashLight": "Taschenlampe umschalten",
|
||||
"toggleFlashLight": "Taschenlampe umschalten",
|
||||
"searchUsernameNotFoundLong": "\"{username}\" ist kein twonly-Benutzer. Bitte überprüfe den Benutzernamen und versuche es erneut.",
|
||||
"errorUnknown": "Ein unerwarteter Fehler ist aufgetreten. Bitte versuche es später erneut.",
|
||||
"errorBadRequest": "Die Anfrage konnte vom Server aufgrund einer fehlerhaften Syntax nicht verstanden werden. Bitte überprüfe deine Eingabe und versuche es erneut.",
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@
|
|||
"protectAsARealTwonly": "Send as real twonly!",
|
||||
"addDrawing": "Drawing",
|
||||
"addEmoji": "Emoji",
|
||||
"toogleFlashLight": "Toggle the flash light",
|
||||
"toggleFlashLight": "Toggle the flash light",
|
||||
"searchUsernameNotFoundLong": "\"{username}\" is not a twonly user. Please check the username and try again.",
|
||||
"errorUnknown": "An unexpected error has occurred. Please try again later.",
|
||||
"errorBadRequest": "The request could not be understood by the server due to malformed syntax. Please check your input and try again.",
|
||||
|
|
|
|||
|
|
@ -4,9 +4,6 @@ import 'package:twonly/src/model/messages_model.dart';
|
|||
|
||||
// This provider will update the UI on changes in the contact list
|
||||
class ContactChangeProvider with ChangeNotifier, DiagnosticableTreeMixin {
|
||||
// The page index of the HomeView widget
|
||||
// int _activePageIdx = 0;
|
||||
|
||||
List<Contact> _allContacts = [];
|
||||
final Map<int, DbMessage> _lastMessagesGroupedByUser = <int, DbMessage>{};
|
||||
|
||||
|
|
@ -15,13 +12,6 @@ class ContactChangeProvider with ChangeNotifier, DiagnosticableTreeMixin {
|
|||
.length;
|
||||
List<Contact> get allContacts => _allContacts;
|
||||
|
||||
// int get activePageIdx => _activePageIdx;
|
||||
|
||||
// void setActivePageIdx(int idx) {
|
||||
// _activePageIdx = idx;
|
||||
// notifyListeners();
|
||||
// }
|
||||
|
||||
void update() async {
|
||||
_allContacts = await DbContacts.getUsers();
|
||||
for (Contact contact in _allContacts) {
|
||||
|
|
|
|||
12
lib/src/providers/send_next_media_to.dart
Normal file
12
lib/src/providers/send_next_media_to.dart
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import 'package:flutter/foundation.dart';
|
||||
|
||||
// This provider will update the UI on changes in the contact list
|
||||
class SendNextMediaTo with ChangeNotifier, DiagnosticableTreeMixin {
|
||||
int? _sendNextMediaToUserId;
|
||||
|
||||
int? get sendNextMediaToUserId => _sendNextMediaToUserId;
|
||||
void updateSendNextMediaTo(int? userId) {
|
||||
_sendNextMediaToUserId = userId;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
|
@ -133,7 +133,6 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
|
|||
},
|
||||
builder: (cameraState, preview) {
|
||||
return Stack(
|
||||
//alignment: Alignment.bottomCenter,
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: GestureDetector(
|
||||
|
|
@ -185,7 +184,7 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
|
|||
// SizedBox(height: 20),
|
||||
ActionButton(
|
||||
FontAwesomeIcons.bolt,
|
||||
tooltipText: context.lang.toogleFlashLight,
|
||||
tooltipText: context.lang.toggleFlashLight,
|
||||
color: isFlashOn
|
||||
? const Color.fromARGB(255, 255, 230, 0)
|
||||
: const Color.fromARGB(
|
||||
|
|
@ -280,107 +279,3 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
String beautifulZoomScale(double scale) {
|
||||
var tmp = scale.toStringAsFixed(1);
|
||||
if (tmp[0] == "0") {
|
||||
tmp = tmp.substring(1, tmp.length);
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
class CameraZoomButtons extends StatefulWidget {
|
||||
const CameraZoomButtons(
|
||||
{super.key,
|
||||
required this.isFront,
|
||||
required this.updateScaleFactor,
|
||||
required this.scaleFactor});
|
||||
|
||||
final bool isFront;
|
||||
final double scaleFactor;
|
||||
final Function updateScaleFactor;
|
||||
|
||||
@override
|
||||
State<CameraZoomButtons> createState() => _CameraZoomButtonsState();
|
||||
}
|
||||
|
||||
class _CameraZoomButtonsState extends State<CameraZoomButtons> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final zoomButtonStyle = TextButton.styleFrom(
|
||||
padding: EdgeInsets.zero,
|
||||
foregroundColor: Colors.white,
|
||||
minimumSize: Size(40, 40),
|
||||
alignment: Alignment.center,
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap);
|
||||
|
||||
final zoomTextStyle = TextStyle(fontSize: 13);
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.circular(40.0),
|
||||
child: Container(
|
||||
color: const Color.fromARGB(90, 0, 0, 0),
|
||||
child: Row(
|
||||
children: widget.isFront
|
||||
? []
|
||||
: [
|
||||
TextButton(
|
||||
style: zoomButtonStyle,
|
||||
onPressed: () async {
|
||||
// var level = await widget.controller.getMinZoomLevel();
|
||||
// widget.updateScaleFactor(level);
|
||||
},
|
||||
child: Text(""),
|
||||
// child: FutureBuilder(
|
||||
// future: widget.controller.getMinZoomLevel(),
|
||||
// builder: (context, snap) {
|
||||
// if (snap.hasData) {
|
||||
// var minLevel =
|
||||
// beautifulZoomScale(snap.data!.toDouble());
|
||||
// var currentLevel =
|
||||
// beautifulZoomScale(widget.scaleFactor);
|
||||
// return Text(
|
||||
// widget.scaleFactor < 1
|
||||
// ? "${currentLevel}x"
|
||||
// : "${minLevel}x",
|
||||
// style: zoomTextStyle,
|
||||
// );
|
||||
// } else {
|
||||
// return Text("");
|
||||
// }
|
||||
// }),
|
||||
),
|
||||
TextButton(
|
||||
style: zoomButtonStyle,
|
||||
onPressed: () {
|
||||
widget.updateScaleFactor(1.0);
|
||||
},
|
||||
child: Text(
|
||||
widget.scaleFactor >= 1
|
||||
? "${beautifulZoomScale(widget.scaleFactor)}x"
|
||||
: "1.0x",
|
||||
style: zoomTextStyle,
|
||||
)),
|
||||
TextButton(
|
||||
style: zoomButtonStyle,
|
||||
onPressed: () async {
|
||||
// var level = await widget.controller.getMaxZoomLevel();
|
||||
// widget.updateScaleFactor(level);
|
||||
},
|
||||
child: Text(""),
|
||||
// child: FutureBuilder(
|
||||
// future: widget.controller.getMaxZoomLevel(),
|
||||
// builder: (context, snap) {
|
||||
// if (snap.hasData) {
|
||||
// var maxLevel = snap.data?.toInt();
|
||||
// return Text("${maxLevel}x", style: zoomTextStyle);
|
||||
// } else {
|
||||
// return Text("");
|
||||
// }
|
||||
// }),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,13 @@
|
|||
import 'package:fixnum/fixnum.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:twonly/src/components/image_editor/action_button.dart';
|
||||
import 'package:twonly/src/components/media_view_sizing.dart';
|
||||
import 'package:twonly/src/components/notification_badge.dart';
|
||||
import 'package:twonly/src/providers/api/api.dart';
|
||||
import 'package:twonly/src/providers/contacts_change_provider.dart';
|
||||
import 'package:twonly/src/providers/send_next_media_to.dart';
|
||||
import 'package:twonly/src/utils/misc.dart';
|
||||
import 'package:twonly/src/views/camera_to_share/share_image_view.dart';
|
||||
import 'dart:async';
|
||||
|
|
@ -12,6 +17,7 @@ import 'package:twonly/src/components/image_editor/data/layer.dart';
|
|||
import 'package:twonly/src/components/image_editor/layers_viewer.dart';
|
||||
import 'package:twonly/src/components/image_editor/modules/all_emojis.dart';
|
||||
import 'package:screenshot/screenshot.dart';
|
||||
import 'package:twonly/src/views/home_view.dart';
|
||||
|
||||
List<Layer> layers = [];
|
||||
List<Layer> undoLayers = [];
|
||||
|
|
@ -221,6 +227,17 @@ class _ShareImageEditorView extends State<ShareImageEditorView> {
|
|||
Widget build(BuildContext context) {
|
||||
pixelRatio = MediaQuery.of(context).devicePixelRatio;
|
||||
|
||||
int? sendNextMediaToUserId =
|
||||
context.watch<SendNextMediaTo>().sendNextMediaToUserId;
|
||||
String? sendNextMediaToUserName;
|
||||
if (sendNextMediaToUserId != null) {
|
||||
sendNextMediaToUserName = context
|
||||
.watch<ContactChangeProvider>()
|
||||
.allContacts
|
||||
.firstWhere((x) => x.userId == sendNextMediaToUserId)
|
||||
.displayName;
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white.withAlpha(0),
|
||||
resizeToAvoidBottomInset: false,
|
||||
|
|
@ -287,15 +304,7 @@ class _ShareImageEditorView extends State<ShareImageEditorView> {
|
|||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
OutlinedButton.icon(
|
||||
icon: _imageSaving
|
||||
? SizedBox(
|
||||
width: 12,
|
||||
height: 12,
|
||||
child: CircularProgressIndicator(strokeWidth: 1))
|
||||
: _imageSaved
|
||||
? Icon(Icons.check)
|
||||
: FaIcon(FontAwesomeIcons.floppyDisk),
|
||||
OutlinedButton(
|
||||
style: OutlinedButton.styleFrom(
|
||||
iconColor: _imageSaved
|
||||
? Theme.of(context).colorScheme.outline
|
||||
|
|
@ -318,14 +327,64 @@ class _ShareImageEditorView extends State<ShareImageEditorView> {
|
|||
});
|
||||
}
|
||||
},
|
||||
label: Text(_imageSaved
|
||||
? context.lang.shareImagedEditorSavedImage
|
||||
: context.lang.shareImagedEditorSaveImage),
|
||||
child: Row(
|
||||
children: [
|
||||
_imageSaving
|
||||
? SizedBox(
|
||||
width: 12,
|
||||
height: 12,
|
||||
child: CircularProgressIndicator(strokeWidth: 1))
|
||||
: _imageSaved
|
||||
? Icon(Icons.check)
|
||||
: FaIcon(FontAwesomeIcons.floppyDisk),
|
||||
if (sendNextMediaToUserName == null) SizedBox(width: 10),
|
||||
if (sendNextMediaToUserName == null)
|
||||
Text(_imageSaved
|
||||
? context.lang.shareImagedEditorSavedImage
|
||||
: context.lang.shareImagedEditorSaveImage)
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
if (sendNextMediaToUserName != null) SizedBox(width: 10),
|
||||
if (sendNextMediaToUserName != null)
|
||||
OutlinedButton(
|
||||
style: OutlinedButton.styleFrom(
|
||||
iconColor: Theme.of(context).colorScheme.primary,
|
||||
foregroundColor: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
onPressed: () async {
|
||||
Future<Uint8List?> imageBytes = getMergedImage();
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => ShareImageView(
|
||||
imageBytesFuture: imageBytes,
|
||||
isRealTwonly: _isRealTwonly,
|
||||
maxShowTime: _maxShowTime,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: FaIcon(FontAwesomeIcons.userPlus),
|
||||
),
|
||||
if (sendNextMediaToUserName != null) SizedBox(width: 10),
|
||||
if (sendNextMediaToUserName == null) SizedBox(width: 20),
|
||||
FilledButton.icon(
|
||||
icon: FaIcon(FontAwesomeIcons.solidPaperPlane),
|
||||
onPressed: () {
|
||||
onPressed: () async {
|
||||
if (sendNextMediaToUserId != null) {
|
||||
Navigator.popUntil(context, (route) => route.isFirst);
|
||||
Uint8List? imageBytes = await getMergedImage();
|
||||
globalUpdateOfHomeViewPageIndex(1);
|
||||
sendImage(
|
||||
[Int64(sendNextMediaToUserId)],
|
||||
imageBytes!,
|
||||
_isRealTwonly,
|
||||
_maxShowTime,
|
||||
);
|
||||
// send hier...
|
||||
return;
|
||||
}
|
||||
Future<Uint8List?> imageBytes = getMergedImage();
|
||||
Navigator.push(
|
||||
context,
|
||||
|
|
@ -344,7 +403,9 @@ class _ShareImageEditorView extends State<ShareImageEditorView> {
|
|||
),
|
||||
),
|
||||
label: Text(
|
||||
context.lang.shareImagedEditorShareWith,
|
||||
(sendNextMediaToUserName == null)
|
||||
? context.lang.shareImagedEditorShareWith
|
||||
: sendNextMediaToUserName,
|
||||
style: TextStyle(fontSize: 17),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import 'package:twonly/src/components/verified_shield.dart';
|
|||
import 'package:twonly/src/model/contacts_model.dart';
|
||||
import 'package:twonly/src/providers/api/api.dart';
|
||||
import 'package:twonly/src/providers/messages_change_provider.dart';
|
||||
import 'package:twonly/src/providers/send_next_media_to.dart';
|
||||
import 'package:twonly/src/utils/misc.dart';
|
||||
import 'package:twonly/src/views/home_view.dart';
|
||||
|
||||
|
|
@ -46,6 +47,11 @@ class _ShareImageView extends State<ShareImageView> {
|
|||
}
|
||||
|
||||
Future<void> _loadAsync() async {
|
||||
int? sendNextMediaToUserId =
|
||||
context.read<SendNextMediaTo>().sendNextMediaToUserId;
|
||||
if (sendNextMediaToUserId != null) {
|
||||
_selectedUserIds.add(Int64(sendNextMediaToUserId));
|
||||
}
|
||||
_users = await DbContacts.getActiveUsers();
|
||||
_updateUsers(_users);
|
||||
imageBytes = await widget.imageBytesFuture;
|
||||
|
|
|
|||
|
|
@ -12,10 +12,12 @@ import 'package:twonly/src/providers/api/api.dart';
|
|||
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/providers/send_next_media_to.dart';
|
||||
import 'package:twonly/src/services/notification_service.dart';
|
||||
import 'package:twonly/src/views/chats/media_viewer_view.dart';
|
||||
import 'package:twonly/src/utils/misc.dart';
|
||||
import 'package:twonly/src/views/contact/contact_view.dart';
|
||||
import 'package:twonly/src/views/home_view.dart';
|
||||
|
||||
class ChatListEntry extends StatelessWidget {
|
||||
const ChatListEntry(this.message, this.user, this.lastMessageFromSameUser,
|
||||
|
|
@ -130,9 +132,10 @@ class ChatItemDetailsView extends StatefulWidget {
|
|||
|
||||
class _ChatItemDetailsViewState extends State<ChatItemDetailsView> {
|
||||
int lastChangeCounter = 0;
|
||||
final TextEditingController newMessageController = TextEditingController();
|
||||
TextEditingController newMessageController = TextEditingController();
|
||||
HashSet<int> alreadyReportedOpened = HashSet<int>();
|
||||
late Contact user;
|
||||
String currentInputText = "";
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
|
@ -148,6 +151,7 @@ class _ChatItemDetailsViewState extends State<ChatItemDetailsView> {
|
|||
setState(() {});
|
||||
await sendTextMessage(user.userId, newMessageController.text);
|
||||
newMessageController.clear();
|
||||
currentInputText = "";
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
@ -247,6 +251,10 @@ class _ChatItemDetailsViewState extends State<ChatItemDetailsView> {
|
|||
Expanded(
|
||||
child: TextField(
|
||||
controller: newMessageController,
|
||||
onChanged: (value) {
|
||||
currentInputText = value;
|
||||
setState(() {});
|
||||
},
|
||||
onSubmitted: (_) {
|
||||
_sendMessage();
|
||||
},
|
||||
|
|
@ -277,12 +285,22 @@ class _ChatItemDetailsViewState extends State<ChatItemDetailsView> {
|
|||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
IconButton(
|
||||
icon: FaIcon(FontAwesomeIcons.solidPaperPlane),
|
||||
onPressed: () {
|
||||
_sendMessage();
|
||||
},
|
||||
),
|
||||
(currentInputText != "")
|
||||
? IconButton(
|
||||
icon: FaIcon(FontAwesomeIcons.solidPaperPlane),
|
||||
onPressed: () {
|
||||
_sendMessage();
|
||||
},
|
||||
)
|
||||
: IconButton(
|
||||
icon: FaIcon(FontAwesomeIcons.camera),
|
||||
onPressed: () {
|
||||
context.read<SendNextMediaTo>().updateSendNextMediaTo(
|
||||
widget.user.userId.toInt());
|
||||
globalUpdateOfHomeViewPageIndex(0);
|
||||
Navigator.popUntil(context, (route) => route.isFirst);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -12,9 +12,11 @@ import 'package:twonly/src/providers/api/api.dart';
|
|||
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/providers/send_next_media_to.dart';
|
||||
import 'package:twonly/src/utils/misc.dart';
|
||||
import 'package:twonly/src/views/chats/chat_item_details_view.dart';
|
||||
import 'package:twonly/src/views/chats/media_viewer_view.dart';
|
||||
import 'package:twonly/src/views/home_view.dart';
|
||||
import 'package:twonly/src/views/settings/settings_main_view.dart';
|
||||
import 'package:twonly/src/views/chats/search_username_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
|
@ -206,7 +208,10 @@ class _UserListItem extends State<UserListItem> {
|
|||
leading: InitialsAvatar(displayName: widget.user.displayName),
|
||||
onTap: () {
|
||||
if (widget.lastMessage == null) {
|
||||
print("TODO: implement sending to one person!");
|
||||
context
|
||||
.read<SendNextMediaTo>()
|
||||
.updateSendNextMediaTo(widget.user.userId.toInt());
|
||||
globalUpdateOfHomeViewPageIndex(0);
|
||||
return;
|
||||
}
|
||||
if (isDownloading) return;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,19 @@
|
|||
import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:local_auth/local_auth.dart';
|
||||
import 'package:lottie/lottie.dart';
|
||||
import 'package:no_screenshot/no_screenshot.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:twonly/src/components/media_view_sizing.dart';
|
||||
import 'package:twonly/src/model/contacts_model.dart';
|
||||
import 'package:twonly/src/model/json/message.dart';
|
||||
import 'package:twonly/src/model/messages_model.dart';
|
||||
import 'package:twonly/src/providers/api/api.dart';
|
||||
import 'package:twonly/src/providers/send_next_media_to.dart';
|
||||
import 'package:twonly/src/services/notification_service.dart';
|
||||
import 'package:twonly/src/views/home_view.dart';
|
||||
|
||||
final _noScreenshot = NoScreenshot.instance;
|
||||
|
||||
|
|
@ -212,31 +216,36 @@ class _MediaViewerViewState extends State<MediaViewerView> {
|
|||
],
|
||||
),
|
||||
),
|
||||
// if (_imageByte != null)
|
||||
// Positioned(
|
||||
// bottom: 30,
|
||||
// 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),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
if (_imageByte != null)
|
||||
Positioned(
|
||||
bottom: 30,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// const SizedBox(width: 20),
|
||||
FilledButton.icon(
|
||||
icon: FaIcon(FontAwesomeIcons.solidPaperPlane),
|
||||
onPressed: () async {
|
||||
context.read<SendNextMediaTo>().updateSendNextMediaTo(
|
||||
widget.otherUser.userId.toInt());
|
||||
globalUpdateOfHomeViewPageIndex(0);
|
||||
Navigator.popUntil(context, (route) => route.isFirst);
|
||||
},
|
||||
style: ButtonStyle(
|
||||
padding: WidgetStateProperty.all<EdgeInsets>(
|
||||
EdgeInsets.symmetric(vertical: 10, horizontal: 30),
|
||||
),
|
||||
),
|
||||
label: Text(
|
||||
"Respond",
|
||||
style: TextStyle(fontSize: 17),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:pie_menu/pie_menu.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:twonly/src/providers/send_next_media_to.dart';
|
||||
import 'camera_to_share/camera_preview_view.dart';
|
||||
import 'chats/chat_list_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
|
@ -24,6 +26,9 @@ class HomeViewState extends State<HomeView> {
|
|||
activePageIdx = widget.initialPage;
|
||||
homeViewPageController = PageController(initialPage: widget.initialPage);
|
||||
globalUpdateOfHomeViewPageIndex = (index) {
|
||||
if (index == 1) {
|
||||
context.read<SendNextMediaTo>().updateSendNextMediaTo(null);
|
||||
}
|
||||
homeViewPageController.jumpToPage(index);
|
||||
setState(() {
|
||||
activePageIdx = index;
|
||||
|
|
@ -35,7 +40,6 @@ class HomeViewState extends State<HomeView> {
|
|||
void dispose() {
|
||||
// disable globalCallbacks to the flutter tree
|
||||
globalUpdateOfHomeViewPageIndex = (a) {};
|
||||
//homeViewPageController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
|
@ -67,6 +71,9 @@ class HomeViewState extends State<HomeView> {
|
|||
body: PageView(
|
||||
controller: homeViewPageController,
|
||||
onPageChanged: (index) {
|
||||
if (index == 1) {
|
||||
context.read<SendNextMediaTo>().updateSendNextMediaTo(null);
|
||||
}
|
||||
activePageIdx = index;
|
||||
setState(() {});
|
||||
},
|
||||
|
|
@ -93,6 +100,9 @@ class HomeViewState extends State<HomeView> {
|
|||
],
|
||||
onTap: (int index) {
|
||||
activePageIdx = index;
|
||||
if (index == 1) {
|
||||
context.read<SendNextMediaTo>().updateSendNextMediaTo(null);
|
||||
}
|
||||
setState(() {
|
||||
homeViewPageController.animateToPage(
|
||||
index,
|
||||
|
|
|
|||
Loading…
Reference in a new issue