Skip to content

Instantly share code, notes, and snippets.

@tirth-aubergine tirth-aubergine/home.dart
Last active Dec 12, 2019

Embed
What would you like to do?
Platypus - HomeProvider
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
You can’t perform that action at this time.