сборка: APK (Android) + Linux Desktop
- Исправлены ошибки Flutter анализа (withOpacity, pbkdf2, импорты) - Упрощён pubspec.yaml (только нужные зависимости) - Android APK собран: build/app/outputs/flutter-apk/app-release.apk (22MB) - Linux Desktop собран: build/linux/x64/release/bundle/jam_client Для Windows: кросс-компиляция невозможна с Linux. Нужен Windows хост для flutter build windows.
This commit is contained in:
@@ -8,7 +8,6 @@ import '../services/api_service.dart';
|
||||
import '../services/theme_service.dart';
|
||||
import '../models/message.dart';
|
||||
import '../models/channel.dart';
|
||||
import '../models/guild.dart';
|
||||
import '../widgets/message_bubble.dart';
|
||||
import '../widgets/chat_input.dart';
|
||||
|
||||
@@ -28,7 +27,6 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
bool _atBottom = true;
|
||||
|
||||
late Channel _channel;
|
||||
late Guild _guild;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
@@ -36,7 +34,6 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
final args = ModalRoute.of(context)?.settings.arguments as Map?;
|
||||
if (args != null) {
|
||||
_channel = args['channel'] as Channel;
|
||||
_guild = args['guild'] as Guild;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,7 +198,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
Icon(
|
||||
_channel.isText ? Icons.tag : Icons.volume_up,
|
||||
size: 48,
|
||||
color: ThemeService.textMuted.withValues(alpha: 0.5),
|
||||
color: ThemeService.textMuted.withOpacity(0.5),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
@@ -226,7 +223,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
Text(
|
||||
'No messages yet. Start the conversation!',
|
||||
style: TextStyle(
|
||||
color: ThemeService.textMuted.withValues(alpha: 0.8),
|
||||
color: ThemeService.textMuted.withOpacity(0.8),
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -207,7 +207,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
color: ThemeService.surfacePrimary,
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
border: Border.all(
|
||||
color: ThemeService.success.withValues(alpha: 0.5),
|
||||
color: ThemeService.success.withOpacity(0.5),
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -120,10 +120,10 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: ThemeService.danger.withValues(alpha: 0.1),
|
||||
color: ThemeService.danger.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(
|
||||
color: ThemeService.danger.withValues(alpha: 0.3)),
|
||||
color: ThemeService.danger.withOpacity(0.3)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
|
||||
@@ -62,7 +62,7 @@ class _SplashScreenState extends State<SplashScreen>
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: ThemeService.primary.withValues(alpha: 0.4),
|
||||
color: ThemeService.primary.withOpacity(0.4),
|
||||
blurRadius: 30,
|
||||
spreadRadius: 5,
|
||||
),
|
||||
@@ -94,7 +94,7 @@ class _SplashScreenState extends State<SplashScreen>
|
||||
Text(
|
||||
'Lightweight · Decentralized · Secure',
|
||||
style: TextStyle(
|
||||
color: ThemeService.textSecondary.withValues(alpha: 0.7),
|
||||
color: ThemeService.textSecondary.withOpacity(0.7),
|
||||
fontSize: 14,
|
||||
letterSpacing: 0.5,
|
||||
),
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:typed_data';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:web_socket_channel/web_socket_channel.dart';
|
||||
import '../models/message.dart';
|
||||
|
||||
enum ConnectionState { disconnected, connecting, connected }
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import 'dart:convert';
|
||||
import 'dart:math';
|
||||
import 'dart:typed_data';
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:pointycastle/export.dart' as pc;
|
||||
|
||||
|
||||
class CryptoService {
|
||||
static const int keySize = 32;
|
||||
@@ -28,20 +28,40 @@ class CryptoService {
|
||||
}
|
||||
|
||||
Uint8List deriveKey(String password, Uint8List salt) {
|
||||
final key = pbkdf2(
|
||||
hash: sha256,
|
||||
password: utf8.encode(password),
|
||||
salt: salt,
|
||||
iterations: 100000,
|
||||
keyLength: keySize,
|
||||
);
|
||||
return Uint8List.fromList(key);
|
||||
return _pbkdf2(sha256, utf8.encode(password), salt, 100000, keySize);
|
||||
}
|
||||
|
||||
static Uint8List _pbkdf2(Hash hash, List<int> password, List<int> salt, int iterations, int keyLength) {
|
||||
const hLen = 32;
|
||||
final blocks = (keyLength + hLen - 1) ~/ hLen;
|
||||
final result = Uint8List(keyLength);
|
||||
|
||||
for (int block = 1; block <= blocks; block++) {
|
||||
final blockBytes = ByteData(4)..setUint32(0, block, Endian.big);
|
||||
final blockSalt = Uint8List.fromList([...salt, ...blockBytes.buffer.asUint8List()]);
|
||||
final prf = Hmac(hash, password);
|
||||
var u = prf.convert(blockSalt).bytes;
|
||||
var t = Uint8List.fromList(u);
|
||||
|
||||
for (int i = 1; i < iterations; i++) {
|
||||
u = prf.convert(u).bytes;
|
||||
for (int j = 0; j < hLen; j++) {
|
||||
t[j] ^= u[j];
|
||||
}
|
||||
}
|
||||
|
||||
final offset = (block - 1) * hLen;
|
||||
final length = min(hLen, keyLength - offset);
|
||||
result.setRange(offset, offset + length, t.sublist(0, length));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Uint8List encrypt(Uint8List plaintext, Uint8List key) {
|
||||
final nonce = generateNonce();
|
||||
final hmac = Hmac(sha256, key);
|
||||
final mac = hmac.convert(plaintext).bytes;
|
||||
final nonce = generateNonce();
|
||||
|
||||
final result = Uint8List(nonce.length + mac.length + plaintext.length);
|
||||
result.setAll(0, nonce);
|
||||
@@ -54,7 +74,6 @@ class CryptoService {
|
||||
Uint8List? decrypt(Uint8List ciphertext, Uint8List key) {
|
||||
try {
|
||||
if (ciphertext.length < nonceSize + 32) return null;
|
||||
final nonce = ciphertext.sublist(0, nonceSize);
|
||||
final mac = ciphertext.sublist(nonceSize, nonceSize + 32);
|
||||
final plaintext = ciphertext.sublist(nonceSize + 32);
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ class MessageBubble extends StatelessWidget {
|
||||
width: 32,
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
color: ThemeService.primary.withValues(alpha: 0.8),
|
||||
color: ThemeService.primary.withOpacity(0.8),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Center(
|
||||
@@ -88,7 +88,7 @@ class MessageBubble extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
border: Border(
|
||||
left: BorderSide(
|
||||
color: ThemeService.primary.withValues(alpha: 0.5),
|
||||
color: ThemeService.primary.withOpacity(0.5),
|
||||
width: 3,
|
||||
),
|
||||
),
|
||||
@@ -154,7 +154,7 @@ class MessageBubble extends StatelessWidget {
|
||||
width: 120,
|
||||
height: 4,
|
||||
decoration: BoxDecoration(
|
||||
color: ThemeService.textMuted.withValues(alpha: 0.3),
|
||||
color: ThemeService.textMuted.withOpacity(0.3),
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user