Change type for sizeAttribute from String to double

pull/31/head
ritheshSalyan 4 years ago
parent 717ceeb85d
commit 6203c1d4a6
  1. 6
      app/assets/sample_data.json
  2. 14
      app/lib/pages/home_page.dart
  3. 4
      lib/models/documents/attribute.dart

@ -451,7 +451,7 @@
}, },
{ {
"attributes": { "attributes": {
"size": "small" "size": 12.0
}, },
"insert": "Small" "insert": "Small"
}, },
@ -460,7 +460,7 @@
}, },
{ {
"attributes": { "attributes": {
"size": "large" "size": 35.0
}, },
"insert": "Large" "insert": "Large"
}, },
@ -469,7 +469,7 @@
}, },
{ {
"attributes": { "attributes": {
"size": "huge" "size": 60.0
}, },
"insert": "Huge" "insert": "Huge"
}, },

@ -1,6 +1,7 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'dart:math';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -66,6 +67,13 @@ class _HomePageState extends State<HomePage> {
color: Colors.grey.shade800, color: Colors.grey.shade800,
child: _buildMenuBar(context), child: _buildMenuBar(context),
), ),
floatingActionButton: FloatingActionButton(
onPressed: (){
int option = Random().nextInt(30);
print(option);
_controller.formatSelection(SizeAttribute(option.toDouble()));
},
),
body: RawKeyboardListener( body: RawKeyboardListener(
focusNode: FocusNode(), focusNode: FocusNode(),
onKey: (RawKeyEvent event) { onKey: (RawKeyEvent event) {
@ -111,13 +119,15 @@ class _HomePageState extends State<HomePage> {
TextStyle( TextStyle(
fontSize: 32.0, fontSize: 32.0,
color: Colors.black, color: Colors.black,
height: 1.15, height:1.15,
fontWeight: FontWeight.w300, fontWeight: FontWeight.w300,
), ),
Tuple2(16.0, 0.0), Tuple2(16.0, 0.0),
Tuple2(0.0, 0.0), Tuple2(0.0, 0.0),
null), null),
sizeSmall: TextStyle(fontSize: 9.0)), sizeSmall: TextStyle(fontSize: 9.0),
sizeHuge: TextStyle(fontSize:64.0)
),
), ),
), ),
), ),

@ -205,8 +205,8 @@ class FontAttribute extends Attribute<double> {
FontAttribute(double val) : super('font', AttributeScope.INLINE, val); FontAttribute(double val) : super('font', AttributeScope.INLINE, val);
} }
class SizeAttribute extends Attribute<String> { class SizeAttribute extends Attribute<double> {
SizeAttribute(String val) : super('size', AttributeScope.INLINE, val); SizeAttribute(double val) : super('size', AttributeScope.INLINE, val);
} }
class LinkAttribute extends Attribute<String> { class LinkAttribute extends Attribute<String> {

Loading…
Cancel
Save