This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import androidx.compose.runtime.Composable | |
import androidx.compose.ui.platform.LocalConfiguration | |
import androidx.compose.ui.unit.Dp | |
import androidx.compose.ui.unit.dp | |
@Composable | |
fun rememberWindowInfo(): WindowInfo { | |
val configuration = LocalConfiguration.current | |
return WindowInfo( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//make sure your target sdk is 33+ and androidx.activity:activity-compose dependency is updated | |
var imageUri by remember { | |
mutableStateOf<Uri?>(null) | |
} | |
val imageLauncher = rememberLauncherForActivityResult( | |
contract = ActivityResultContracts.PickVisualMedia(), | |
onResult = { uri -> imageUri = uri } | |
) | |
Column(modifier = Modifier.fillMaxSize(), verticalArrangement = Arrangement.Center, horizontalAlignment = Alignment.CenterHorizontally) { | |
Button(onClick = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by Taha Ben Ashur (https://github.com/tahaak67) on 08,Feb,2023 | |
*/ | |
sealed class Resource<T>( | |
val data: T? = null, | |
val message: String? = null | |
) { | |
class Success<T>(data: T) : Resource<T>(data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Dependencies | |
import 'dart:async'; | |
import 'dart:convert'; | |
import 'package:http/http.dart' as http; | |
//Album = Object/Class name | |
//fetchAlbum() = function name | |
//Gnerate dart class from json using JsonToDart for Android Studio https://plugins.jetbrains.com/plugin/12562-jsontodart-json-to-dart-/ | |
Future<Album> fetchAlbum() async { | |
final response = |