Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions lib/src/localization/app_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import 'app_localizations_ru.dart';
/// property.
abstract class AppLocalizations {
AppLocalizations(String locale)
: localeName = intl.Intl.canonicalizedLocale(locale.toString());
: localeName = intl.Intl.canonicalizedLocale(locale.toString());

final String localeName;

Expand All @@ -86,16 +86,16 @@ abstract class AppLocalizations {
/// of delegates is preferred or required.
static const List<LocalizationsDelegate<dynamic>> localizationsDelegates =
<LocalizationsDelegate<dynamic>>[
delegate,
GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
];
delegate,
GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
];

/// A list of this localizations delegate's supported locales.
static const List<Locale> supportedLocales = <Locale>[
Locale('en'),
Locale('ru'),
Locale('ru')
];

/// The title of the application
Expand Down Expand Up @@ -132,9 +132,8 @@ AppLocalizations lookupAppLocalizations(Locale locale) {
}

throw FlutterError(
'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
'an issue with the localizations generation tool. Please file an issue '
'on GitHub with a reproducible sample app and the gen-l10n configuration '
'that was used.',
);
'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
'an issue with the localizations generation tool. Please file an issue '
'on GitHub with a reproducible sample app and the gen-l10n configuration '
'that was used.');
}
185 changes: 132 additions & 53 deletions lib/src/screens/foreground_switch_screen.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:md_ui_kit/widgets/gradient_scaffold_wrapper.dart';
import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:wave_p2p/src/core/keys.dart';
Expand Down Expand Up @@ -90,101 +92,178 @@ class ForegroundSwitchScreenState extends State<ForegroundSwitchScreen> {
switch (stepper) {
// Экран с кнопкой "Start", скрывается если нажался хотя бы раз
case VisibleScreenType.startButton:
return StartScreen(
key: ValueKey<String>('startButton$postfix'),
onNext: _onStartButtonPressed,
return GradientScaffoldWrapper(
showLogo: true,
showArrow: false,
iosTopPadding: kIsWeb ? 28 : 90,
onTapBack: () {
setState(() {
_stepper = VisibleScreenType.selectAction;
});
},
child: StartScreen(
key: ValueKey<String>('startButton$postfix'),
onNext: _onStartButtonPressed,
),
);

// Экран с кнопкой "Mic on", скрывается если нажался хотя бы раз
// без анимации, если проигрывается после startButton
case VisibleScreenType.micOn:
return AnimatedContainerWrapper(
purpleTitle: 'One more step',
isAnimated: false,
key: ValueKey<String>('micOn$postfix'),
topPadding: topPadding,
child: EnableMicrophoneScreen(
onNext: _onEnableMicPressed,
return GradientScaffoldWrapper(
showLogo: true,
showArrow: false,
iosTopPadding: kIsWeb ? 28 : 90,
onTapBack: () {
setState(() {
_stepper = VisibleScreenType.selectAction;
});
},
child: AnimatedContainerWrapper(
purpleTitle: 'One more step',
isAnimated: false,
key: ValueKey<String>('micOn$postfix'),
topPadding: topPadding,
child: EnableMicrophoneScreen(
onNext: _onEnableMicPressed,
),
),
);

// Экран с кнопкой "Mic on", скрывается если нажался хотя бы раз
// с анимацией, если открывается сразу после заставки
case VisibleScreenType.micOnAnimated:
return AnimatedContainerWrapper(
purpleTitle: 'One more step',
isAnimated: true,
key: ValueKey<String>('minOnAnimated$postfix'),
topPadding: topPadding,
child: EnableMicrophoneScreen(
onNext: _onEnableMicPressed,
return GradientScaffoldWrapper(
showLogo: true,
showArrow: false,
iosTopPadding: kIsWeb ? 28 : 90,
onTapBack: () {
setState(() {
_stepper = VisibleScreenType.selectAction;
});
},
child: AnimatedContainerWrapper(
purpleTitle: 'One more step',
isAnimated: true,
key: ValueKey<String>('minOnAnimated$postfix'),
topPadding: topPadding,
child: EnableMicrophoneScreen(
onNext: _onEnableMicPressed,
),
),
);

// Экран с выбором действия - создать/вставить код
// без анимации, если проигрывается после micOn
case VisibleScreenType.selectAction:
return AnimatedContainerWrapper(
isAnimated: false,
key: ValueKey<String>('selectAction$postfix'),
topPadding: topPadding,
child: StartConnectionScreen(
onCreateCode: _onCreateCodePressed,
onPasteCode: _onPasteCodePressed,
// TODO: remove reconnect functionality
onOrPressed: _onOrPressed,
return GradientScaffoldWrapper(
showLogo: true,
showArrow: false,
iosTopPadding: kIsWeb ? 28 : 90,
onTapBack: () {
setState(() {
_stepper = VisibleScreenType.selectAction;
});
},
child: AnimatedContainerWrapper(
isAnimated: false,
key: ValueKey<String>('selectAction$postfix'),
topPadding: topPadding,
child: StartConnectionScreen(
onCreateCode: _onCreateCodePressed,
onPasteCode: _onPasteCodePressed,
// TODO: remove reconnect functionality
onOrPressed: _onOrPressed,
),
),
);

// Экран с выбором действия - создать/вставить код
// без анимации, если проигрывается после micOn
case VisibleScreenType.selectActionAnimated:
return AnimatedContainerWrapper(
key: ValueKey<String>('selectActionAnimated$postfix'),
topPadding: topPadding,
isAnimated: true,
child: StartConnectionScreen(
onCreateCode: _onCreateCodePressed,
onPasteCode: _onPasteCodePressed,
// TODO: remove reconnect functionality
onOrPressed: _onOrPressed,
return GradientScaffoldWrapper(
showLogo: true,
showArrow: false,
iosTopPadding: kIsWeb ? 28 : 90,
onTapBack: () {
setState(() {
_stepper = VisibleScreenType.selectAction;
});
},
child: AnimatedContainerWrapper(
key: ValueKey<String>('selectActionAnimated$postfix'),
topPadding: topPadding,
isAnimated: true,
child: StartConnectionScreen(
onCreateCode: _onCreateCodePressed,
onPasteCode: _onPasteCodePressed,
// TODO: remove reconnect functionality
onOrPressed: _onOrPressed,
),
),
);

// Экран создания кода
case VisibleScreenType.createCode:
return AnimatedContainerWrapper(
key: ValueKey<String>('createCode$postfix'),
topPadding: topPadding,
isAnimated: false,
child: CopyCodeScreen(
onCheckPairPressed: _onCheckPairPressed,
return GradientScaffoldWrapper(
showLogo: true,
iosTopPadding: kIsWeb ? 28 : 90,
onTapBack: () {
setState(() {
_stepper = VisibleScreenType.selectAction;
});
},
child: AnimatedContainerWrapper(
key: ValueKey<String>('createCode$postfix'),
topPadding: topPadding,
isAnimated: false,
child: CopyCodeScreen(
onCheckPairPressed: _onCheckPairPressed,
),
),
);

// Экран вставки кода
case VisibleScreenType.pasteCode:
return AnimatedContainerWrapper(
key: ValueKey<String>('pasteCode$postfix'),
topPadding: topPadding,
isAnimated: false,
child: PasteCodeScreen(
onConnectPressed: _onCheckAnswerPressed,
return GradientScaffoldWrapper(
showLogo: true,
iosTopPadding: kIsWeb ? 28 : 90,
onTapBack: () {
setState(() {
_stepper = VisibleScreenType.selectAction;
});
},
child: AnimatedContainerWrapper(
key: ValueKey<String>('pasteCode$postfix'),
topPadding: topPadding,
isAnimated: false,
child: PasteCodeScreen(
onConnectPressed: _onCheckAnswerPressed,
),
),
);

// Основной экран с динамичным навбаром, скаффолдом с адаптивной высотой и волной
case VisibleScreenType.main:
return MainScreen(
key: ValueKey<String>('main$postfix'),
topPadding: topPadding,
isPeerInitiator: _isPeerInitiator,
onReturnPressed: () {
return GradientScaffoldWrapper(
showLogo: true,
iosTopPadding: kIsWeb ? 28 : 90,
onTapBack: () {
setState(() {
_stepper = VisibleScreenType.selectAction;
});
},
onClosePeerPressed: _onClosePeerPressed,
child: MainScreen(
key: ValueKey<String>('main$postfix'),
topPadding: topPadding,
isPeerInitiator: _isPeerInitiator,
onReturnPressed: () {
setState(() {
_stepper = VisibleScreenType.selectAction;
});
},
onClosePeerPressed: _onClosePeerPressed,
),
);

// TODO: DO NOT REMOVE TO PREFENT FAILURE ON PROD
Expand Down
18 changes: 0 additions & 18 deletions lib/src/screens/home_screen.dart

This file was deleted.

12 changes: 5 additions & 7 deletions lib/src/screens/initial_screen_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:md_ui_kit/_core/colors.dart';
import 'package:md_ui_kit/screens/initial_screen.dart';
import 'package:wave_p2p/src/screens/home_screen.dart';
import 'package:wave_p2p/src/screens/foreground_switch_screen.dart';

class InitialScreenImpl extends StatefulWidget {
const InitialScreenImpl({super.key});
Expand Down Expand Up @@ -37,13 +37,11 @@ class _InitialScreenImplState extends State<InitialScreenImpl> {

@override
Widget build(BuildContext context) {
return
kDebugMode
? HomeScreen(
return kDebugMode
? ForegroundSwitchScreen(
key: ValueKey("home"),
)
:
AnimatedSwitcher(
: AnimatedSwitcher(
duration: const Duration(milliseconds: 400),
layoutBuilder: (currentChild, previousChildren) {
return DecoratedBox(
Expand Down Expand Up @@ -75,7 +73,7 @@ class _InitialScreenImplState extends State<InitialScreenImpl> {
wavePositionedBottom: kIsWeb ? 120 : 100,
);
case false:
return const HomeScreen(
return const ForegroundSwitchScreen(
key: ValueKey("home"),
);
}
Expand Down
Loading