Skip to content

Commit

Permalink
bump flutter version
Browse files Browse the repository at this point in the history
  • Loading branch information
boyan01 committed Sep 4, 2024
1 parent 023fd36 commit 5e1e702
Show file tree
Hide file tree
Showing 14 changed files with 13,273 additions and 424 deletions.
31 changes: 24 additions & 7 deletions lib/db/web/src/construct_db_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,33 @@

import 'dart:html';

import 'package:drift/web.dart';
import 'package:drift/drift.dart';
import 'package:drift/wasm.dart';

import '../../../util/logger.dart';
import '../../mixin_database.dart';

Future<MixinDatabase> constructDb(String _) async => MixinDatabase(
WebDatabase.withStorage(
await DriftWebStorage.indexedDbIfSupported('mixin'),
logStatements: false,
),
);
DatabaseConnection connectOnWeb() =>
DatabaseConnection.delayed(Future(() async {
final result = await WasmDatabase.open(
databaseName: 'mixin',
sqlite3Uri: Uri.parse('sqlite3.wasm'),
driftWorkerUri: Uri.parse('drift_worker.js'),
);

if (result.missingFeatures.isNotEmpty) {
// Depending how central local persistence is to your app, you may want
// to show a warning to the user if only unrealiable implemetentations
// are available.
i('Using ${result.chosenImplementation} due to missing browser '
'features: ${result.missingFeatures}');
}

return result.resolvedExecutor;
}));

Future<MixinDatabase> constructDb(String _) async =>
MixinDatabase(connectOnWeb());

Future<void> deleteDatabase(String _) async {
// delete indexedDB;
Expand Down
33 changes: 28 additions & 5 deletions lib/service/app_services.dart
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,36 @@ class AppServices extends ChangeNotifier with EquatableMixin {
.insertAll(users.data.map((user) => user.toDbUser()).toList());
}

Future<sdk.MixinResponse<List<sdk.Snapshot>>> _getSnapshots({
String? assetId,
String? offset,
int limit = 30,
String? opponent,
String? destination,
String? tag,
}) async {
final resp = await client.dio.get<Map<String, dynamic>>('/snapshots',
queryParameters: <String, dynamic>{
'asset': assetId,
'offset': offset,
'limit': limit,
'opponent': opponent,
'destination': destination,
'tag': tag,
});
return sdk.MixinResponse((resp.data!['data'] as List)
.whereNotNull()
.map((e) => sdk.Snapshot.fromJson(e as Map<String, dynamic>))
.toList());
}

Future<List<sdk.Snapshot>> updateAssetSnapshots(
String assetId, {
String? offset,
int limit = 30,
}) async {
final result = await Future.wait([
client.snapshotApi.getSnapshots(
_getSnapshots(
assetId: assetId,
offset: offset,
limit: limit,
Expand Down Expand Up @@ -328,7 +351,7 @@ class AppServices extends ChangeNotifier with EquatableMixin {
String? tag,
}) async {
final result = await Future.wait([
client.snapshotApi.getSnapshots(
_getSnapshots(
assetId: assetId,
offset: offset,
limit: limit,
Expand Down Expand Up @@ -360,9 +383,9 @@ class AppServices extends ChangeNotifier with EquatableMixin {
String? opponent,
int limit = 30,
}) async {
final snapshots = await client.snapshotApi
.getSnapshots(offset: offset, limit: limit, opponent: opponent)
.then((value) => value.data);
final snapshots =
await _getSnapshots(offset: offset, limit: limit, opponent: opponent)
.then((value) => value.data);

final closures = [
await _checkUsersExistWithReturnInsert(
Expand Down
4 changes: 3 additions & 1 deletion lib/ui/page/all_transactions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,9 @@ class _ExportButton extends StatelessWidget {
limit: limit,
);
}
if (snapshots.isEmpty || snapshots.length < limit) {
// this should compare snapshots.length < limit. but service might has null item
// so we use snapshots.length < 10
if (snapshots.length < 10) {
break;
}
if (range != null &&
Expand Down
3 changes: 1 addition & 2 deletions lib/ui/widget/asset.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ class AssetWidget extends HookWidget {
return InkWell(
onTap: onTap,
child: Container(
height: 72,
padding: const EdgeInsets.all(16),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
child: Row(
children: [
SymbolIconWithBorder(
Expand Down
1 change: 1 addition & 0 deletions lib/ui/widget/avatar.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:mixin_bot_sdk_dart/mixin_bot_sdk_dart.dart';
import '../../util/extension/extension.dart';

import '../brightness_theme_data.dart';
Expand Down
2 changes: 0 additions & 2 deletions lib/util/extension/extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import '../constants.dart';
import '../l10n.dart';

export 'package:collection/collection.dart';
export 'package:mixin_bot_sdk_dart/mixin_bot_sdk_dart.dart'
show UuidHashcodeExtension;
export 'package:provider/provider.dart' show ReadContext, WatchContext;

export '../../ui/widget/brightness_observer.dart';
Expand Down
5 changes: 3 additions & 2 deletions lib/util/extension/src/number.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ extension StringCurrencyExtension on String {
String numberFormat() {
if (isEmpty) return this;
try {
return NumberFormat(asDecimal.toString().getPattern(count: 32))
.format(DecimalIntl(asDecimal));
return DecimalFormatter(
NumberFormat(asDecimal.toString().getPattern(count: 32)))
.format(asDecimal);
} catch (error) {
return this;
}
Expand Down
Loading

0 comments on commit 5e1e702

Please sign in to comment.