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 'package:flutter/material.dart'; | |
extension BuildContextExtensions on BuildContext { | |
ThemeData get theme => Theme.of(this); | |
TextTheme get textTheme => theme.textTheme; | |
ColorScheme get colorScheme => theme.colorScheme; | |
DefaultTextStyle get defaultTextStyle => DefaultTextStyle.of(this); |
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
// This function helps to add a string at the back of each file name IF that | |
// file already exists in the user's file system, so that each file name will | |
// be unique. | |
Future<String> makeFileName(String path, String fileName) async { | |
bool fileExists = await File('$path/$fileName').exists(); | |
if (fileExists) { | |
int counter = 1; | |
List newFileExt = fileName.split('.'); | |
String ext = newFileExt[1]; // refers to the file extension. |