This file contains hidden or 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
// The main maethod (just return the widget name to fetch the data from different methods) | |
import 'package:flutter/material.dart'; | |
import 'package:flutterx/demo.dart'; | |
import 'package:flutterx/photos.dart'; | |
void main() { | |
runApp(const Experiment()); | |
} |
This file contains hidden or 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
// Model for Json DATA | |
class Posts { | |
Posts({ | |
required this.userId, | |
required this.id, | |
required this.title, | |
required this.body, | |
}); | |
late final int userId; |
This file contains hidden or 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
void main(){ | |
while (true) { | |
print("Rock, Paper, Scissors Shoot!"); | |
String playerMove = getPlayerMove(); | |
if (playerMove == "Quit") { | |
return; | |
} | |
print("You played $playerMove"); |
This file contains hidden or 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
// accesing and requesting | |
Future<List<Directory>?>? _externalStorageDirectory; // this will go in future in future builder | |
// this will go in onPresssed if you wanna use button to request everything | |
void requestExternalStorageDirectory(StorageDirectory type) { |
This file contains hidden or 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
// Method | |
// Initialize it into the initState | |
var files = <FileSystemEntity>[]; | |
Future<List<FileSystemEntity>> dirContents(Directory dir) async { | |
var completer = Completer<List<FileSystemEntity>>(); | |
var lister = dir.list(recursive: false, followLinks: false); | |
lister.listen((file) async { | |
FileStat f = file.statSync(); |
This file contains hidden or 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
// Define a simple format function from scratch | |
String dateTimeformat({required DateTime time, bool dateOnly = false}) { | |
String year = time.year.toString(); | |
// Add "0" on the left if month is from 1 to 9 | |
String month = time.month.toString().padLeft(2, '0'); | |
// Add "0" on the left if day is from 1 to 9 | |
String day = time.day.toString().padLeft(2, '0'); |
This file contains hidden or 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
// c represents the Celsius value which you will add according to mode of conversion you want. | |
// r represents the Rankine value which you will add according to mode of conversion you want | |
// k represents the Kelvin value which you will add according to mode of conversion you want. | |
// f represents the Fahrenheit value which you will add according to mode of conversion you want | |
class Temperature { | |
double celsiusToFahrenheit(num c) { | |
return (c * 9 / 5 + 32); | |
} |
This file contains hidden or 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 'dart:ui'; | |
import 'package:flutter/gestures.dart'; | |
import 'package:flutter/widgets.dart'; | |
extension Responsive on BuildContext { | |
// width = yourDeviceWidth, height = yourDeviceHeight | |
This file contains hidden or 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
// demo json file. --------Note the image is from local assest file. so use Image.assest method in dart to access. for network use Image.network in flutter | |
// place json file outside of lib folder | |
[ | |
{ | |
"id": 0, | |
"name": "NexMart - Casual Sneakers", | |
"category": "NOP", | |
"imageUrl": "img/header_onboarding/first_header.png", | |
"oldPrice": "1899", | |
"price": "799" |
This file contains hidden or 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
<uses-permission android:name="android.permission.ACCESS_ALL_DOWNLOADS"/> | |
<uses-permission android:name="android.permission.ACCESS_BLUETOOTH_SHARE"/> | |
<uses-permission android:name="android.permission.ACCESS_CACHE_FILESYSTEM"/> | |
<uses-permission android:name="android.permission.ACCESS_CHECKIN_PROPERTIES"/> | |
<uses-permission android:name="android.permission.ACCESS_CONTENT_PROVIDERS_EXTERNALLY"/> | |
<uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER"/> | |
<uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED"/> | |
<uses-permission android:name="android.permission.ACCESS_DRM_CERTIFICATES"/> | |
<uses-permission android:name="android.permission.ACCESS_EPHEMERAL_APPS"/> | |
<uses-permission android:name="android.permission.ACCESS_FM_RADIO"/> |
OlderNewer