.
This commit is contained in:
@@ -1,54 +0,0 @@
|
||||
// import 'package:nextcloud/nextcloud.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
// import 'package:http/http.dart' as http;
|
||||
|
||||
|
||||
|
||||
const primaryColor = Color.fromARGB(255, 26, 26, 74);
|
||||
const primaryLightColor = Color.fromARGB(150, 238, 224, 173);
|
||||
const double defaultPadding = 15.0;
|
||||
const timeout = 3;
|
||||
// var client = http.Client();
|
||||
// var client = NextcloudClient()
|
||||
|
||||
|
||||
setSharedPref(String key, var value) async {
|
||||
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
|
||||
|
||||
switch (value.runtimeType.toString()) {
|
||||
case 'String':
|
||||
sharedPreferences.setString(key, value);
|
||||
break;
|
||||
|
||||
case 'double':
|
||||
sharedPreferences.setDouble(key, value);
|
||||
break;
|
||||
|
||||
case 'int':
|
||||
sharedPreferences.setInt(key, value);
|
||||
break;
|
||||
|
||||
case 'bool':
|
||||
sharedPreferences.setBool(key, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
getSharedPref(var key, var type) async {
|
||||
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
|
||||
|
||||
switch (type) {
|
||||
case 'String':
|
||||
return sharedPreferences.getString(key);
|
||||
|
||||
case 'double':
|
||||
return sharedPreferences.getDouble(key);
|
||||
|
||||
case 'int':
|
||||
return sharedPreferences.getInt(key);
|
||||
|
||||
case 'bool':
|
||||
return sharedPreferences.getBool(key);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import 'dart:math';
|
||||
|
||||
class FileSize {
|
||||
static FileSize instance = FileSize();
|
||||
|
||||
String getFileSizeString({required int bytes, int decimals = 0}) {
|
||||
const suffixes = ["Bytes", "KB", "MB", "GB", "TB"];
|
||||
if (bytes == 0) return '0 ${suffixes[0]}';
|
||||
|
||||
var i = (log(bytes) / log(1024)).floor();
|
||||
return "${(bytes / pow(1024, i)).toStringAsFixed(
|
||||
i == 0 ? 0 : decimals,
|
||||
)} ${suffixes[i]}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MimetypeIcon {
|
||||
static MimetypeIcon instance = MimetypeIcon();
|
||||
|
||||
IconData getIconForMimeType(String mimeType) {
|
||||
if (mimeType.startsWith('image/')) {
|
||||
return Icons.image;
|
||||
} else if (mimeType.startsWith('video/')) {
|
||||
return Icons.video_file;
|
||||
} else if (mimeType.startsWith('audio/')) {
|
||||
return Icons.audiotrack;
|
||||
} else if (mimeType == 'application/pdf') {
|
||||
return Icons.picture_as_pdf;
|
||||
} else if (mimeType.startsWith('text/')) {
|
||||
return Icons.text_snippet;
|
||||
} else if (mimeType.contains("application/octet-stream")) {
|
||||
return Icons.disc_full_rounded;
|
||||
} else if (mimeType.contains("application/zip")) {
|
||||
return Icons.folder_zip;
|
||||
} else {
|
||||
return Icons.folder; // Default icon
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:nextcloudapp/screens/login_screen.dart';
|
||||
import 'package:nextcloudapp/screens/home_screen.dart';
|
||||
|
||||
class NextcloudAppRoutes {
|
||||
//
|
||||
static NextcloudAppRoutes instance = NextcloudAppRoutes();
|
||||
|
||||
Map<String, WidgetBuilder> get routes => {
|
||||
"login": (BuildContext _context) => LoginScreen(),
|
||||
"home": (BuildContext _context) => HomeSceen(),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user