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
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. | |
# Initialization code that may require console input (password prompts, [y/n] | |
# confirmations, etc.) must go above this block; everything else may go below. | |
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then | |
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" | |
fi | |
# If you come from bash you might have to change your $PATH. | |
# export PATH=$HOME/bin:/usr/local/bin:$PATH |
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 'package:package_info/package_info.dart'; //https://pub.dev/packages/package_info | |
class AppInfo { | |
Future<String> get version async { | |
final PackageInfo packageInfo = await PackageInfo.fromPlatform(); | |
return packageInfo.version ?? 'Unknown Version'; // 1.2.7 | |
} | |
Future<String> get buildNumber async { |
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:io'; | |
import 'package:device_info/device_info.dart'; //https://pub.dev/packages/device_info | |
class DeviceInfo { | |
Future<String> get deviceModel async { | |
final DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); | |
if (Platform.isAndroid) { | |
final AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo; | |
final String manufacturer = androidInfo.manufacturer; |
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' as ui; | |
import 'dart:io'; | |
class DeviceInfo { | |
static double devicePixelRatio = ui.window.devicePixelRatio; | |
static ui.Size size = ui.window.physicalSize; | |
static double width = size.width; | |
static double height = size.height; | |
static double screenWidth = width / devicePixelRatio; | |
static double screenHeight = height / devicePixelRatio; |
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 'package:flutter/material.dart'; | |
extension PaddingExtensions on Widget { | |
Widget horizontalListPadding({ | |
@required int index, | |
@required int listLength, | |
double spacingFirstItem = 16, | |
double spacingLastItem = 16, | |
double spaceBetweenItems = 16, | |
}) { |
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 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Flutter Demo', | |
debugShowCheckedModeBanner: false, |
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 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Flutter Demo', | |
debugShowCheckedModeBanner: false, |
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() { | |
final String _text = 'ExTEnSiON'; | |
print(_text.capitalize()); //Extension | |
} | |
extension StringExtensions on String { | |
String capitalize() { | |
return "${this[0].toUpperCase()}${this.toLowerCase().substring(1)}"; | |
} |
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() { | |
final String _text = 'ExTEnSiON'; | |
String _capitalize(String text){ | |
return "${text[0].toUpperCase()}${text.toLowerCase().substring(1)}"; | |
} | |
print(_capitalize(_text)); //Extension | |
} |
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 'package:flutter/material.dart'; | |
import 'dart:math' as math; | |
class Carousel<T> extends StatefulWidget { | |
final Widget child; | |
final List<T> items; | |
final double itemExtent; | |
final double itemWidth; | |
final double itemHorizontalMargin; | |
final double listHeight; |