feat: Add splash screen and update routing to include it
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -20,7 +20,7 @@ pubspec.lock
|
||||
*.xcworkspace
|
||||
*.xcuserdatad
|
||||
*.xcodeproj/project.xcworkspace
|
||||
/ios/.Datadriven
|
||||
/ios/.DerivedData
|
||||
|
||||
# VS Code
|
||||
/.vscode/
|
||||
|
||||
22
ios/Podfile.lock
Normal file
22
ios/Podfile.lock
Normal file
@@ -0,0 +1,22 @@
|
||||
PODS:
|
||||
- Flutter (1.0.0)
|
||||
- flutter_secure_storage (6.0.0):
|
||||
- Flutter
|
||||
|
||||
DEPENDENCIES:
|
||||
- Flutter (from `Flutter`)
|
||||
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
Flutter:
|
||||
:path: Flutter
|
||||
flutter_secure_storage:
|
||||
:path: ".symlinks/plugins/flutter_secure_storage/ios"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
|
||||
flutter_secure_storage: 2c2ff13db9e0a5647389bff88b0ecac56e3f3418
|
||||
|
||||
PODFILE CHECKSUM: 3c63482e143d1b91d2d2560aee9fb04ecc74ac7e
|
||||
|
||||
COCOAPODS: 1.16.2
|
||||
@@ -14,6 +14,8 @@
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
|
||||
B913F0048B857E161928913B /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0BA79DF64522AEA564FF9738 /* Pods_RunnerTests.framework */; };
|
||||
F7989140904F00576D04273C /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F98F105E4E18A0B9A77603EA /* Pods_Runner.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@@ -40,13 +42,20 @@
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
0BA79DF64522AEA564FF9738 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
|
||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
||||
1936EC177EDE1DAF1156511F /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
1D43224145C8EB6D880C6E11 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
|
||||
294CB407B31A1E0CEF7B9935 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
|
||||
331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
|
||||
331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
||||
45421BF3EE052CE5236E185A /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = "<group>"; };
|
||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
790A74B63F7D1EF8E156DF13 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
79C02E3489ECFAEE3BBD5226 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = "<group>"; };
|
||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
|
||||
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
|
||||
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
|
||||
@@ -55,6 +64,7 @@
|
||||
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
F98F105E4E18A0B9A77603EA /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -62,6 +72,15 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
F7989140904F00576D04273C /* Pods_Runner.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
D0FDAAC5AA2EC9A81903694C /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
B913F0048B857E161928913B /* Pods_RunnerTests.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -76,6 +95,20 @@
|
||||
path = RunnerTests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
38ECD1455BD37F93BE453F5C /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
790A74B63F7D1EF8E156DF13 /* Pods-Runner.debug.xcconfig */,
|
||||
294CB407B31A1E0CEF7B9935 /* Pods-Runner.release.xcconfig */,
|
||||
1D43224145C8EB6D880C6E11 /* Pods-Runner.profile.xcconfig */,
|
||||
1936EC177EDE1DAF1156511F /* Pods-RunnerTests.debug.xcconfig */,
|
||||
45421BF3EE052CE5236E185A /* Pods-RunnerTests.release.xcconfig */,
|
||||
79C02E3489ECFAEE3BBD5226 /* Pods-RunnerTests.profile.xcconfig */,
|
||||
);
|
||||
name = Pods;
|
||||
path = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9740EEB11CF90186004384FC /* Flutter */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -94,6 +127,8 @@
|
||||
97C146F01CF9000F007C117D /* Runner */,
|
||||
97C146EF1CF9000F007C117D /* Products */,
|
||||
331C8082294A63A400263BE5 /* RunnerTests */,
|
||||
38ECD1455BD37F93BE453F5C /* Pods */,
|
||||
FFB0CC6850B54F8C1B6AA3CF /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
@@ -121,6 +156,15 @@
|
||||
path = Runner;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
FFB0CC6850B54F8C1B6AA3CF /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F98F105E4E18A0B9A77603EA /* Pods_Runner.framework */,
|
||||
0BA79DF64522AEA564FF9738 /* Pods_RunnerTests.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@@ -128,8 +172,10 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */;
|
||||
buildPhases = (
|
||||
270A1CEE19DC36A7C1634BFF /* [CP] Check Pods Manifest.lock */,
|
||||
331C807D294A63A400263BE5 /* Sources */,
|
||||
331C807F294A63A400263BE5 /* Resources */,
|
||||
D0FDAAC5AA2EC9A81903694C /* Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -145,12 +191,14 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
|
||||
buildPhases = (
|
||||
C0D31F1AE76EC2FF2874C406 /* [CP] Check Pods Manifest.lock */,
|
||||
9740EEB61CF901F6004384FC /* Run Script */,
|
||||
97C146EA1CF9000F007C117D /* Sources */,
|
||||
97C146EB1CF9000F007C117D /* Frameworks */,
|
||||
97C146EC1CF9000F007C117D /* Resources */,
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||
943532F3A5ABC7C5E2D510CC /* [CP] Embed Pods Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -222,6 +270,28 @@
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
270A1CEE19DC36A7C1634BFF /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
@@ -238,6 +308,23 @@
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
|
||||
};
|
||||
943532F3A5ABC7C5E2D510CC /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
9740EEB61CF901F6004384FC /* Run Script */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
@@ -253,6 +340,28 @@
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
|
||||
};
|
||||
C0D31F1AE76EC2FF2874C406 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
@@ -379,6 +488,7 @@
|
||||
};
|
||||
331C8088294A63A400263BE5 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 1936EC177EDE1DAF1156511F /* Pods-RunnerTests.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
@@ -396,6 +506,7 @@
|
||||
};
|
||||
331C8089294A63A400263BE5 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 45421BF3EE052CE5236E185A /* Pods-RunnerTests.release.xcconfig */;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
@@ -411,6 +522,7 @@
|
||||
};
|
||||
331C808A294A63A400263BE5 /* Profile */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 79C02E3489ECFAEE3BBD5226 /* Pods-RunnerTests.profile.xcconfig */;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
@@ -616,4 +728,4 @@
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 97C146E61CF9000F007C117D /* Project object */;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:provider/provider.dart';
|
||||
import 'screens/login_screen.dart';
|
||||
import 'screens/profile_screen.dart';
|
||||
import 'screens/schedule_screen.dart';
|
||||
import 'screens/splash_screen.dart';
|
||||
import 'services/auth_service.dart';
|
||||
|
||||
void main() {
|
||||
@@ -21,8 +22,9 @@ class MyApp extends StatelessWidget {
|
||||
primaryColor: Color(0xFFA24BFA),
|
||||
scaffoldBackgroundColor: Color(0xFF0c0a0a),
|
||||
),
|
||||
initialRoute: '/',
|
||||
initialRoute: '/splash',
|
||||
routes: {
|
||||
'/splash': (context) => SplashScreen(),
|
||||
'/': (context) => LoginScreen(),
|
||||
'/profile': (context) => ProfileScreen(),
|
||||
'/schedule': (context) => ScheduleScreen(),
|
||||
|
||||
@@ -13,6 +13,7 @@ class _ScheduleScreenState extends State<ScheduleScreen> {
|
||||
DateTime currentWeek = DateTime.now();
|
||||
bool loading = false;
|
||||
List<dynamic> workdays = [];
|
||||
String? errorMsg;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -31,34 +32,48 @@ class _ScheduleScreenState extends State<ScheduleScreen> {
|
||||
IconButton(icon: Icon(Icons.chevron_right), onPressed: () { setState(() { currentWeek = currentWeek.add(Duration(days: 7)); }); fetchWorkdays(); }),
|
||||
]),
|
||||
SizedBox(height: 8),
|
||||
loading ? CircularProgressIndicator() : Expanded(
|
||||
child: LayoutBuilder(builder: (ctx, cons) {
|
||||
final cross = cons.maxWidth > 480 ? 4 : 2;
|
||||
return GridView.count(
|
||||
crossAxisCount: cross,
|
||||
childAspectRatio: 0.9,
|
||||
children: weekDays.map((day) {
|
||||
final formatted = DateFormat('yyyy-MM-dd').format(day);
|
||||
final wd = workdays.firstWhere((w) => (w['WorkDay'] ?? '').toString().substring(0,10) == formatted, orElse: () => null);
|
||||
String title = '';
|
||||
if (wd != null) {
|
||||
if (wd['Type'] == 1) title = 'PN';
|
||||
else if (wd['Type'] == 10) title = wd['text'] ?? '';
|
||||
}
|
||||
return Card(
|
||||
color: wd != null && wd['Type'] == 10 ? Color(0xFFA24BFA) : (wd != null && wd['Type'] == 1 ? Color(0xFFB388FF) : Color(0xFFede7f6)),
|
||||
child: Center(
|
||||
child: Column(mainAxisSize: MainAxisSize.min, children: [
|
||||
Text('${day.day}', style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
|
||||
SizedBox(height: 6),
|
||||
Text(title, style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold)),
|
||||
]),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
);
|
||||
})
|
||||
)
|
||||
if (errorMsg != null) ...[
|
||||
Text(errorMsg!, style: TextStyle(color: Colors.red)),
|
||||
SizedBox(height: 8),
|
||||
ElevatedButton(onPressed: fetchWorkdays, child: Text('Próbálja újra')),
|
||||
SizedBox(height: 8),
|
||||
],
|
||||
loading
|
||||
? Padding(
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: Center(child: CircularProgressIndicator()),
|
||||
)
|
||||
: Expanded(
|
||||
child: RefreshIndicator(
|
||||
onRefresh: fetchWorkdays,
|
||||
child: LayoutBuilder(builder: (ctx, cons) {
|
||||
final cross = cons.maxWidth > 480 ? 4 : 2;
|
||||
return GridView.count(
|
||||
crossAxisCount: cross,
|
||||
childAspectRatio: 0.9,
|
||||
children: weekDays.map((day) {
|
||||
final formatted = DateFormat('yyyy-MM-dd').format(day);
|
||||
final wd = workdays.firstWhere((w) => (w['WorkDay'] ?? '').toString().substring(0,10) == formatted, orElse: () => null);
|
||||
String title = '';
|
||||
if (wd != null) {
|
||||
if (wd['Type'] == 1) title = 'PN';
|
||||
else if (wd['Type'] == 10) title = wd['text'] ?? '';
|
||||
}
|
||||
return Card(
|
||||
color: wd != null && wd['Type'] == 10 ? Color(0xFFA24BFA) : (wd != null && wd['Type'] == 1 ? Color(0xFFB388FF) : Color(0xFFede7f6)),
|
||||
child: Center(
|
||||
child: Column(mainAxisSize: MainAxisSize.min, children: [
|
||||
Text('${day.day}', style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
|
||||
SizedBox(height: 6),
|
||||
Text(title, style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold)),
|
||||
]),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
65
lib/screens/splash_screen.dart
Normal file
65
lib/screens/splash_screen.dart
Normal file
@@ -0,0 +1,65 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SplashScreen extends StatefulWidget {
|
||||
@override
|
||||
_SplashScreenState createState() => _SplashScreenState();
|
||||
}
|
||||
|
||||
class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderStateMixin {
|
||||
late AnimationController _ctrl;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_ctrl = AnimationController(vsync: this, duration: Duration(seconds: 3))..repeat(reverse: true);
|
||||
// simulate load then navigate
|
||||
Timer(Duration(seconds: 2), () {
|
||||
Navigator.pushReplacementNamed(context, '/');
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_ctrl.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Color(0xFF0c0a0a),
|
||||
body: Center(
|
||||
child: AnimatedBuilder(
|
||||
animation: _ctrl,
|
||||
builder: (ctx, child) {
|
||||
final t = _ctrl.value;
|
||||
return Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
// liquid-ish blurred circles
|
||||
Container(
|
||||
width: 220 + 40 * t,
|
||||
height: 220 + 40 * (1 - t),
|
||||
decoration: BoxDecoration(
|
||||
gradient: RadialGradient(colors: [Color(0xFFB388FF).withOpacity(0.25), Colors.transparent]),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 140 + 60 * (1 - t),
|
||||
height: 140 + 60 * t,
|
||||
decoration: BoxDecoration(
|
||||
gradient: RadialGradient(colors: [Color(0xFFA24BFA).withOpacity(0.6), Color(0xFF5E2FD3).withOpacity(0.2)]),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
Text('mcbeno', style: TextStyle(fontSize: 28, fontWeight: FontWeight.bold, color: Colors.white)),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -69,10 +69,25 @@ class AuthService extends ChangeNotifier {
|
||||
}
|
||||
|
||||
Future<dynamic> _httpGet(String path) async {
|
||||
if (token == null) return null;
|
||||
final res = await http.get(Uri.parse('$_base$path'), headers: {'Authorization': 'Bearer $token'});
|
||||
if (res.statusCode == 200) return jsonDecode(res.body);
|
||||
return null;
|
||||
if (token == null) {
|
||||
if (kDebugMode) print('[AuthService] _httpGet called without token for $path');
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
final res = await http.get(Uri.parse('$_base$path'), headers: {'Authorization': 'Bearer $token'});
|
||||
if (res.statusCode == 200) {
|
||||
return jsonDecode(res.body);
|
||||
} else {
|
||||
if (kDebugMode) {
|
||||
print('[AuthService] GET $path -> ${res.statusCode}');
|
||||
print('[AuthService] response body: ${res.body}');
|
||||
}
|
||||
throw Exception('HTTP ${res.statusCode}');
|
||||
}
|
||||
} catch (e) {
|
||||
if (kDebugMode) print('[AuthService] _httpGet error: $e');
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _loadToken() async {
|
||||
|
||||
Reference in New Issue
Block a user