Skip to content

Commit

Permalink
Fix build errors, add fvm config, add windows, macos, linux build sup…
Browse files Browse the repository at this point in the history
…port
  • Loading branch information
0niel committed Feb 12, 2024
1 parent f8eeacf commit ffca3e3
Show file tree
Hide file tree
Showing 72 changed files with 2,327 additions and 646 deletions.
20 changes: 13 additions & 7 deletions .metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,26 @@
# This file should be version controlled and should not be manually edited.

version:
revision: "2828ddd9a707d09af00b793a42faaa0f0e2b957f"
channel: "master"
revision: "41456452f29d64e8deb623a3c927524bcf9f111b"
channel: "stable"

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f
base_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f
- platform: aurora
create_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f
base_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
- platform: linux
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
- platform: macos
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
- platform: windows
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b

# User provided section

Expand Down
13 changes: 11 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
{
"dart.lineLength": 120,
"files.insertFinalNewline": true,
"java.configuration.updateBuildConfiguration": "interactive",
"cmake.configureOnOpen": false
}
"cmake.configureOnOpen": false,
"dart.flutterSdkPath": ".fvm/flutter_sdk",
"search.exclude": {
"**/.fvm": true
},
"files.watcherExclude": {
"**/.fvm": true
},
}
2 changes: 1 addition & 1 deletion api/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ environment:

dependencies:
collection: ^1.16.0
dart_frog: ^1.0.1
dart_frog: ^1.1.0
equatable: ^2.0.5
http: ^1.1.2
intl: ^0.18.1
Expand Down
49 changes: 40 additions & 9 deletions lib/common/oauth.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import 'dart:io';

import 'package:oauth2_client/interfaces.dart';
import 'package:oauth2_client/oauth2_client.dart';
import 'package:oauth2_client/oauth2_helper.dart';
import 'package:rtu_mirea_app/common/constants.dart';
import 'package:shared_preferences/shared_preferences.dart';

class MireaNinjaOauth2Client extends OAuth2Client {
MireaNinjaOauth2Client({
Expand All @@ -14,6 +18,8 @@ class MireaNinjaOauth2Client extends OAuth2Client {
);
}

final isDesktop = !(Platform.isAndroid || Platform.isIOS);

class LksOauth2 {
late final OAuth2Helper oauth2Helper;
late final MireaNinjaOauth2Client oauth2Client;
Expand All @@ -22,17 +28,42 @@ class LksOauth2 {
String? redirectUri,
String? customUriScheme,
}) {
if (!isDesktop) {
redirectUri = 'ninja.mirea.mireaapp://oauth2redirect';
customUriScheme = 'ninja.mirea.mireaapp';
} else {
redirectUri = 'http://localhost:9094/oauth2redirect';
customUriScheme = 'http://localhost:9094/oauth2redirect';
}
oauth2Client = MireaNinjaOauth2Client(
customUriScheme: customUriScheme ?? 'ninja.mirea.mireaapp',
redirectUri: redirectUri ?? 'ninja.mirea.mireaapp://oauth2redirect',
customUriScheme: customUriScheme,
redirectUri: redirectUri,
);

oauth2Helper = OAuth2Helper(
oauth2Client,
grantType: OAuth2Helper.authorizationCode,
clientId: lkClientId,
clientSecret: lkClientSecret,
scopes: ['profile', 'livestream', 'employees', 'attendance', 'scores'],
);
oauth2Helper = OAuth2Helper(oauth2Client,
grantType: OAuth2Helper.authorizationCode,
clientId: lkClientId,
clientSecret: lkClientSecret,
scopes: ['profile', 'livestream', 'employees', 'attendance', 'scores'],
webAuthOpts: {
'useWebview': false,
},
tokenStorage: isDesktop ? TokenStorage('windows', storage: _WindowsTokenStorage()) : null);
}
}

class _WindowsTokenStorage extends BaseStorage {
_WindowsTokenStorage();

@override
Future<String?> read(String key) async {
final prefs = await SharedPreferences.getInstance();
return prefs.getString(key);
}

@override
Future<void> write(String key, String value) async {
final prefs = await SharedPreferences.getInstance();
await prefs.setString(key, value);
}
}
32 changes: 0 additions & 32 deletions lib/common/widget_data_init.dart

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class _$UpdateInfoModelImpl implements _UpdateInfoModel {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$UpdateInfoModelImpl &&
Expand Down
18 changes: 8 additions & 10 deletions lib/navigation/routes/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,14 @@ GoRouter createRouter() => GoRouter(
GoRoute(
parentNavigatorKey: _rootNavigatorKey,
path: '/image',
pageBuilder: (context, state) {
return CustomTransitionPage(
fullscreenDialog: true,
opaque: false,
transitionsBuilder: (_, __, ___, child) => child,
child: ImagesViewGallery(
imageUrls: List<String>.from(state.extra as List<dynamic>),
),
);
},
pageBuilder: (context, state) => CustomTransitionPage(
fullscreenDialog: true,
opaque: false,
transitionsBuilder: (_, __, ___, child) => child,
child: ImagesViewGallery(
imageUrls: List<String>.from(state.extra as List<dynamic>),
),
),
),
],
observers: [
Expand Down
119 changes: 81 additions & 38 deletions lib/navigation/widgets/sidebar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,45 +23,88 @@ class Sidebar extends StatelessWidget {
return Container(
width: sidebarWith,
color: AppTheme.colorsOf(context).background01,
child: ListView(
children: [
ListTile(
leading: const Icon(Icons.library_books_rounded),
title: Text("Новости", style: AppTextStyle.tab),
selected: currentIndex == 0,
onTap: () => onClick(0),
selectedColor: AppTheme.colors.primary,
),
ListTile(
leading: const Icon(Icons.calendar_today_rounded),
title: Text("Расписание", style: AppTextStyle.tab),
selected: currentIndex == 1,
onTap: () => onClick(1),
selectedColor: AppTheme.colors.primary,
),
ListTile(
leading: const Icon(Icons.widgets_rounded),
title: Text("Сервисы", style: AppTextStyle.tab),
selected: currentIndex == 2,
onTap: () => onClick(2),
selectedColor: AppTheme.colors.primary,
),
isDesktop
? ListTile(
leading: const Icon(UniconsLine.info_circle),
title: Text("О приложении", style: AppTextStyle.tab),
selected: currentIndex == 3,
onTap: () => onClick(3),
selectedColor: AppTheme.colors.primary,
)
: ListTile(
leading: const Icon(Icons.person),
title: Text("Профиль", style: AppTextStyle.tab),
selected: currentIndex == 3,
onTap: () => onClick(3),
selectedColor: AppTheme.colors.primary,
child: Padding(
padding: const EdgeInsets.all(16),
child: ListView(
children: [
SidebarNavButton(
isSelected: currentIndex == 0,
title: "Новости",
icon: const Icon(Icons.library_books_rounded),
onClick: () => onClick(0),
),
SidebarNavButton(
isSelected: currentIndex == 1,
title: "Расписание",
icon: const Icon(Icons.calendar_today_rounded),
onClick: () => onClick(1),
),
SidebarNavButton(
isSelected: currentIndex == 2,
title: "Сервисы",
icon: const Icon(Icons.widgets_rounded),
onClick: () => onClick(2),
),
SidebarNavButton(
isSelected: currentIndex == 3,
title: "Профиль",
icon: const Icon(Icons.person),
onClick: () => onClick(3),
),
],
),
),
);
}
}

class SidebarNavButton extends StatelessWidget {
const SidebarNavButton({
Key? key,
required this.isSelected,
required this.title,
required this.icon,
required this.onClick,
}) : super(key: key);

final bool isSelected;
final String title;
final Widget icon;
final VoidCallback onClick;

@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.only(top: 8),
decoration: isSelected
? BoxDecoration(
color: AppTheme.colorsOf(context).colorful03,
borderRadius: BorderRadius.circular(8),
)
: null,
child: TextButton(
onPressed: onClick,
style: TextButton.styleFrom(
padding: const EdgeInsets.all(16),
foregroundColor: isSelected ? AppTheme.colorsOf(context).background01 : AppTheme.colorsOf(context).active,
),
child: Row(
children: [
Theme(
data: ThemeData(
iconTheme: IconThemeData(
color: AppTheme.colorsOf(context).active,
),
],
),
child: icon,
),
const SizedBox(width: 16),
Text(
title,
style: AppTextStyle.buttonS.copyWith(color: AppTheme.colorsOf(context).active),
),
],
),
),
);
}
Expand Down
3 changes: 1 addition & 2 deletions lib/neon/bloc/neon_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class NeonState extends Equatable {
bool? isRegisterOfferViewed,
}) {
return NeonState(
isRegisterOfferViewed:
isRegisterOfferViewed ?? this.isRegisterOfferViewed,
isRegisterOfferViewed: isRegisterOfferViewed ?? this.isRegisterOfferViewed,
);
}
}
1 change: 1 addition & 0 deletions lib/presentation/pages/profile/profile_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ class _InitialProfileStatePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(0, 24, 0, 24),
Expand Down
Loading

0 comments on commit ffca3e3

Please sign in to comment.