Skip to content

Commit

Permalink
add expand
Browse files Browse the repository at this point in the history
  • Loading branch information
pwrshi committed Dec 22, 2022
1 parent 027e91c commit d99c9fd
Show file tree
Hide file tree
Showing 10 changed files with 215 additions and 112 deletions.
1 change: 1 addition & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Для получения дополнительной информации посетите: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [

{
"name": "rsue_app",
"request": "launch",
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "disabled"
}
2 changes: 2 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ android {
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}

signingConfigs {
Expand All @@ -82,4 +83,5 @@ flutter {

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:multidex:2.0.1'
}
9 changes: 9 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import 'package:flutter/material.dart';
import 'package:intl/date_symbol_data_local.dart';
import 'package:onesignal_flutter/onesignal_flutter.dart';
import 'package:rsue_app/src/di_and_navigation.dart';

void main() async {
// await initHive();
// OneSignal.shared.setLogLevel(OSLogLevel.verbose, OSLogLevel.none);

// OneSignal.shared.setAppId("YOUR_ONESIGNAL_APP_ID");

// The promptForPushNotificationsWithUserResponse function will show the iOS or Android push notification prompt. We recommend removing the following code and instead using an In-App Message to prompt for notification permission
// OneSignal.shared.promptUserForPushNotificationPermission().then((accepted) {
// print("Accepted permission: $accepted");
// });
initializeDateFormatting('ru').then((_) => runApp(const RsueApplication()));
}
1 change: 1 addition & 0 deletions lib/src/di_and_navigation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class RsueApplication extends StatelessWidget {

@override
Widget build(BuildContext context) {

return MultiProvider(
providers: [
//
Expand Down
9 changes: 8 additions & 1 deletion lib/src/presentation/screens/loading.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_displaymode/flutter_displaymode.dart';
import 'package:provider/provider.dart';
import 'package:rsue_app/src/domain/repositories/portfolio_repository.dart';
import 'package:rsue_app/src/domain/repositories/schedule_repository.dart';
Expand All @@ -8,9 +11,13 @@ class LoadingScreen extends StatelessWidget {

@override
Widget build(BuildContext context) {
if (Platform.isAndroid) {
FlutterDisplayMode.setHighRefreshRate();
}

Future.sync(() async => [
await context.read<PortfolioRepository>().isAuthorized(),
await context.read<ScheduleRepository>().isAuthorized()
await context.read<ScheduleRepository>().isAuthorized(),
]).then((List<bool> value) {
if (value[0] && value[1]) {
Navigator.pushNamedAndRemoveUntil(context, "/home", (route) => false);
Expand Down
90 changes: 69 additions & 21 deletions lib/src/presentation/screens/profile.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,61 @@
import 'package:expandable/expandable.dart';
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:rsue_app/src/core/api/response.dart';
import 'package:rsue_app/src/domain/entities/subject_entity.dart';
import 'package:rsue_app/src/presentation/providers/data/portfolio_snapshot.dart';
import 'package:rsue_app/src/presentation/widgets/app_bar.dart';
import 'package:rsue_app/src/presentation/widgets/schedule/subject.dart';

class ExpandSemesterWidget extends StatelessWidget {
final List<SubjectEntity> subjects;
final String title;

const ExpandSemesterWidget(this.title, this.subjects, {super.key});

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(top: 8),
child: ExpandablePanel(
theme: const ExpandableThemeData(
useInkWell: false,
hasIcon: false,
),
header: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15.0),
color: const Color(0xff486581)),
padding: const EdgeInsets.all(10.0),
child: Row(
children: [
Expanded(child: Text(title)),
ExpandableIcon(
theme: ExpandableThemeData(
iconColor: Theme.of(context).textTheme.bodyMedium?.color,
))
],
),
),
collapsed: Container(),
expanded: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: subjects
.map<Widget>((subject) => SubjectWidget(
name: subject.name,
controlPoints: subject.controlPoints,
teacher: subject.teachersname,
isClosed: subject.isClosed,
statement: subject.statement,
type: SubjectWidget.sessionTypeToString(subject.type)))
.toList(),
),
),
);
}
}

class ProfileScreen extends StatelessWidget {
const ProfileScreen({super.key});

Expand Down Expand Up @@ -112,27 +162,25 @@ class ProfileScreen extends StatelessWidget {
child: Text(value.data.error.toString()),
);
default:
return Column(
children: [
for (var s
in (value.data.content?.entries.toList() ?? [])) ...[
Padding(
padding: const EdgeInsets.only(
top: 20.0, left: 8, right: 8, bottom: 8),
child: Text(s.key),
),
for (var subject in s.value)
SubjectWidget(
name: subject.name,
controlPoints: subject.controlPoints,
teacher: subject.teachersname,
isClosed: subject.isClosed,
statement: subject.statement,
type:
SubjectWidget.sessionTypeToString(subject.type))
]
],
);
return Column(children: [
for (var s in (value.data.content?.entries.toList() ?? []))
ExpandSemesterWidget(s.key, s.value)

// Padding(
// padding: const EdgeInsets.only(
// top: 20.0, left: 8, right: 8, bottom: 8),
// child: Text(s.key),
// ),
// for (var subject in s.value)
// SubjectWidget(
// name: subject.name,
// controlPoints: subject.controlPoints,
// teacher: subject.teachersname,
// isClosed: subject.isClosed,
// statement: subject.statement,
// type:
// SubjectWidget.sessionTypeToString(subject.type))
]);
}
// if (snapshot.hasData) {
// if (snapshot.data is DataFailed) {
Expand Down
87 changes: 46 additions & 41 deletions lib/src/presentation/widgets/short_info/right_column.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import 'package:provider/provider.dart';
import 'package:rsue_app/src/domain/entities/subject_entity.dart';
import 'package:rsue_app/src/presentation/providers/widget/short_info.dart';

const animationCurve = Curves.easeIn;
const animationSpeed = Duration(milliseconds: 200);
const animationCurveOut = Curves.easeOut;
const _colorOfInnerColumn = Color(0xFF0FCA7A);
const _colorOfOuterColumn = Color(0xFF334E68);

class ChartWhatNeedsToBeImproved extends StatefulWidget {
const ChartWhatNeedsToBeImproved({Key? key}) : super(key: key);

Expand All @@ -20,7 +26,7 @@ class ChartWhatNeedsToBeImprovedState
return Column(
children: [
AnimatedSwitcher(
duration: const Duration(milliseconds: 80),
duration: const Duration(milliseconds: 200),
child: SizedBox(
key: ValueKey(nameOfSelectedItem),
height: 30,
Expand Down Expand Up @@ -77,12 +83,7 @@ class RadioPerfomanceButton extends StatelessWidget {
final SubjectEntity entity;
final bool selected;
final void Function()? onTap;
static const animationSpeed = Duration(milliseconds: 200);

static const animationCurveIn = Curves.easeIn;
static const animationCurveOut = Curves.easeOut;
final _colorOfInnerColumn = const Color(0xFF0FCA7A);
final _colorOfOuterColumn = const Color(0xFF334E68);
String calcString() {
var result = "";
if (entity.controlPoints.length == 1) {
Expand Down Expand Up @@ -115,13 +116,13 @@ class RadioPerfomanceButton extends StatelessWidget {
alignment: Alignment.bottomLeft,
children: [
AnimatedContainer(
height: (absoluteHeight <= 70 ? 70 : absoluteHeight).toDouble(),
height: (absoluteHeight <= 90 ? 90 : absoluteHeight).toDouble(),
width: selected ? 55 : 23,
alignment: Alignment.centerRight,
curve: animationCurveIn,
curve: animationCurve,
duration: animationSpeed,
child: AnimatedSwitcher(
switchInCurve: animationCurveIn,
switchInCurve: animationCurve,
switchOutCurve: animationCurveOut,
duration: animationSpeed,
child: Text(calcString(),
Expand All @@ -132,7 +133,7 @@ class RadioPerfomanceButton extends StatelessWidget {
)),
Column(mainAxisAlignment: MainAxisAlignment.end, children: [
AnimatedSwitcher(
switchInCurve: animationCurveIn,
switchInCurve: animationCurve,
switchOutCurve: animationCurveOut,
duration: animationSpeed,
child: Padding(
Expand All @@ -152,47 +153,23 @@ class RadioPerfomanceButton extends StatelessWidget {
),
),
Container(
// curve: animationCurveIn,
// curve: animationCurve,
// duration: animationSpeed,
clipBehavior: Clip.antiAlias,
alignment: Alignment.topLeft,
decoration: BoxDecoration(
decoration: const BoxDecoration(
color: _colorOfOuterColumn,
borderRadius: const BorderRadius.all(Radius.circular(20))),
borderRadius: BorderRadius.all(Radius.circular(20))),
child: Column(
children: [
for (var i = 0, mark = 0;
i < entity.absoluteControlPoints.length;)
() {
mark = entity.absoluteControlPoints[i++] * 2;
return (i == 1
? AnimatedContainer(
curve: animationCurveIn,
margin: entity.absoluteControlPoints.length == 1
? const EdgeInsets.all(3)
: const EdgeInsets.only(
top: 3, left: 3, right: 3),
duration: animationSpeed,
width: (selected ? 17 : 9),
height: mark.toDouble(),
decoration: BoxDecoration(
color: _colorOfInnerColumn,
borderRadius: const BorderRadius.all(
Radius.circular(20))),
)
: AnimatedContainer(
curve: animationCurveIn,
margin: const EdgeInsets.all(3),
duration: animationSpeed,
width: (selected ? 17 : 9),
height: mark.toDouble(),
decoration: BoxDecoration(
color: selected
? _colorOfInnerColumn
: _colorOfOuterColumn,
borderRadius: const BorderRadius.all(
Radius.circular(20))),
));
return ControlPointWidget(
selected: selected,
mark: mark,
);
}.call(),
],
),
Expand All @@ -205,6 +182,34 @@ class RadioPerfomanceButton extends StatelessWidget {
}
}

class ControlPointWidget extends StatelessWidget {
const ControlPointWidget(
{super.key,
this.selected = false,
this.hasBottomMargin = false,
required this.mark});

final bool selected;
final int mark;
final bool hasBottomMargin;

@override
Widget build(BuildContext context) {
return AnimatedContainer(
curve: animationCurve,
margin: hasBottomMargin
? const EdgeInsets.all(3)
: const EdgeInsets.only(top: 3, left: 3, right: 3),
duration: animationSpeed,
width: (selected ? 17 : 9),
height: mark.toDouble(),
decoration: const BoxDecoration(
color: _colorOfInnerColumn,
borderRadius: BorderRadius.all(Radius.circular(20))),
);
}
}

class RightColumnInfoWidget extends StatelessWidget {
const RightColumnInfoWidget({
Key? key,
Expand Down
Loading

0 comments on commit d99c9fd

Please sign in to comment.