Line data Source code
1 : import 'package:flutter/material.dart'; 2 : import 'package:flutter/widgets.dart'; 3 : import 'package:pal/src/ui/editor/pages/helper_editor/font_editor/pickers/font_weight_picker/font_weight_picker_loader.dart'; 4 : 5 : // Put all notifiers models here 6 : 7 : class TextFormFieldNotifier { 8 : String hintText; 9 : int id; 10 : ValueNotifier<String> text; 11 : ValueNotifier<String> fontFamily; 12 : ValueNotifier<String> fontWeight; 13 : ValueNotifier<Color> fontColor; 14 : ValueNotifier<Color> backgroundColor; 15 : ValueNotifier<Color> borderColor; 16 : ValueNotifier<int> fontSize; 17 : 18 3 : TextFormFieldNotifier({ 19 : int id, 20 : @required String text, 21 : @required Color fontColor, 22 : String fontFamily, 23 : String fontWeight, 24 : Color backgroundColor, 25 : Color borderColor, 26 : @required int fontSize, 27 : String hintText, 28 : }) { 29 3 : this.id = id; 30 6 : this.text = ValueNotifier(text); 31 6 : this.fontColor = ValueNotifier(fontColor); 32 6 : this.fontFamily = ValueNotifier(fontFamily ?? 'Montserrat'); 33 7 : this.fontWeight = ValueNotifier(fontWeight ?? FontWeightMapper.toFontKey(FontWeight.normal)); 34 6 : this.backgroundColor = ValueNotifier(backgroundColor ?? Colors.blueAccent); 35 6 : this.borderColor = ValueNotifier(borderColor); 36 6 : this.fontSize = ValueNotifier(fontSize ?? 14); 37 3 : this.hintText = hintText ?? text; 38 : } 39 : } 40 : 41 : class MediaNotifier { 42 : int id; 43 : String uuid; 44 : // ValueNotifier<String> key; 45 : ValueNotifier<String> url; 46 : 47 2 : MediaNotifier({ 48 : // String key, 49 : String url, 50 : int id, 51 : String uuid, 52 : }) { 53 2 : this.id = id; 54 2 : this.uuid = uuid; 55 : // this.key = ValueNotifier(key); 56 4 : this.url = ValueNotifier(url); 57 : } 58 : } 59 : 60 : class LanguageNotifier { 61 : int id; 62 : // TODO: Create an ID ? 63 : 64 3 : LanguageNotifier({ 65 : int id, 66 : }) { 67 3 : this.id = id; 68 : } 69 : } 70 : 71 : class BoxNotifier { 72 : int id; 73 : ValueNotifier<Color> backgroundColor; 74 : 75 3 : BoxNotifier({ 76 : int id, 77 : Color backgroundColor 78 : }) { 79 3 : this.id = id; 80 6 : this.backgroundColor = ValueNotifier(backgroundColor ?? Colors.blueAccent); 81 : } 82 : } 83 : 84 : // TODO: Create border notifier