Skip to content

Commit

Permalink
flutter upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
desistefanova committed Aug 21, 2024
1 parent c03a3a7 commit ffeadb3
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 42 deletions.
10 changes: 2 additions & 8 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"
android:usesCleartextTraffic="true">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
Expand All @@ -38,9 +34,7 @@
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
Expand Down
76 changes: 45 additions & 31 deletions lib/screens/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ class HomeScreenState extends State<HomeScreen> {
final DeviceServicesCubit deviceService =
context.read<DeviceServicesCubit>();
deviceService.state.lastErrorMessage = null;

if (!deviceService.isAuthenticated()) {
context.push("/login");
return Container();
Expand All @@ -94,38 +93,52 @@ class HomeScreenState extends State<HomeScreen> {
child: FutureBuilder<List<String>>(
future: getAllFolders(deviceService),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const CircularProgressIndicator();
} else if (snapshot.hasData) {
final folders = snapshot.data!;
return ListView(
children: photoGridWidgets(folders, deviceService));
} else {
if (snapshot.hasError) {
Future<void>.delayed(const Duration(seconds: 2)).whenComplete(() {
context.push('/sync');
context.push("/sync");
});
return const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"There is no synced photos/videos from this device and nickname.",
textAlign: TextAlign.center,
),
Text(
"Please go the menu and select 'Sync' to setup configurations.",
textAlign: TextAlign.center,
),
Padding(
padding: EdgeInsets.only(top: 10),
child: Text(
"Go to MOBISYNC.EU for help.",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16, fontWeight: FontWeight.bold),
))
]));
return Text((snapshot.error as CustomError).message);
} else {
switch (snapshot.connectionState) {
case ConnectionState.none:
case ConnectionState.waiting:
return const CircularProgressIndicator();
case ConnectionState.active:
case ConnectionState.done:
if (snapshot.hasData) {
final folders = snapshot.data!;
return ListView(
physics: const PageScrollPhysics(),
children: photoGridWidgets(folders, deviceService));
} else {
Future<void>.delayed(const Duration(seconds: 2))
.whenComplete(() {
context.push("/sync");
});
return const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"There is no synced photos/videos from this device and nickname.",
textAlign: TextAlign.center,
),
Text(
"Please go the menu and select 'Sync' to setup configurations.",
textAlign: TextAlign.center,
),
Padding(
padding: EdgeInsets.only(top: 10),
child: Text(
"Go to MOBISYNC.EU for help.",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16, fontWeight: FontWeight.bold),
))
]));
}
}
}
},
));
Expand Down Expand Up @@ -153,6 +166,7 @@ class HomeScreenState extends State<HomeScreen> {
gridDelegate: CustomGridDelegate(dimension: 100.0),
shrinkWrap: true,
itemCount: files.length,
physics: const PageScrollPhysics(),
itemBuilder: (context, index) {
return GridTile(
child: Container(
Expand Down
3 changes: 1 addition & 2 deletions lib/screens/nickname_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class NicknameScreenState extends State<NicknameScreen> {

@override
void initState() {
_nicknameController = TextEditingController()..addListener(clearError);
_nicknameController = TextEditingController();
super.initState();
}

Expand Down Expand Up @@ -109,7 +109,6 @@ class NicknameScreenState extends State<NicknameScreen> {
void clearError() {
if (_errorMessage != null) {
setState(() {
// Reset error message when user starts typing
_errorMessage = null;
});
}
Expand Down
2 changes: 1 addition & 1 deletion macos/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Cocoa
import FlutterMacOS

@NSApplicationMain
@main
class AppDelegate: FlutterAppDelegate {
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return true
Expand Down

0 comments on commit ffeadb3

Please sign in to comment.