Last active
December 12, 2019 10:53
-
-
Save tirth-aubergine/939a662a66455af01848a08b9b84ab5b to your computer and use it in GitHub Desktop.
Platypus - HomeProvider
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'; | |
import 'package:flutter/foundation.dart'; | |
import 'package:flutter_highlight/theme_map.dart'; | |
import 'package:screenshot/screenshot.dart'; | |
import 'package:platypus/utils/utils.dart'; | |
/// | |
/// Manages states for HomeScreen | |
/// | |
class HomeProvider with ChangeNotifier { | |
// it is set to true when share is clicked to generate best code screenshot | |
bool _screenshotMode = false; | |
// keeps track of source code typed by user | |
TextEditingController _codeTextEditingController = TextEditingController(); | |
// helps with screenshot creation | |
ScreenshotController _codeScreenshotController = ScreenshotController(); | |
// syntax highlighting theme of code text-form-field | |
String _codeHighlightTheme = themeMap.keys.first; | |
// programming language of code text-form-field for accurate syntax highlighting | |
String _codeProgrammingLanguage = programmingLanguages.keys.first; | |
// background-color of the container behind the code text-form-field | |
Color _codeBackgroundColor = Colors.white; | |
/* | |
* code text-form-field can't be edited if it is true | |
* code screenshot can't be shared if it is true | |
*/ | |
bool _isPreview = false; | |
// style for 3 circle buttons (red, yellow, green) | |
String _windowThreeCirclesStyle = WindowThreeCirclesStyle.Filled.toString(); | |
/* | |
* position of (red, yellow, green) circle buttons in row | |
* Left for MainAxisAlignment.start | |
* Right for MainAxisAlignment.end | |
* Center for MainAxisAlignment.center | |
*/ | |
String _windowThreeCirclesPosition = 'Left'; | |
// vertical padding between code text-form-field and container behind it | |
double _verticalPaddingBetweenCodeAndBackground = 20; | |
// horizontal padding between code text-form-field and container behind it | |
double _horizontalPaddingBetweenCodeAndBackground = 20; | |
// font-size of the code text-form-field | |
double _codeFontSize = 16; | |
// line-height of the code text-form-field | |
double _codeLineHeight = 0; | |
// shadow of the container behind the code text-form-field | |
bool _showShadow = false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment