forked from flutter/gallery
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode_style.dart
More file actions
43 lines (38 loc) · 1.29 KB
/
code_style.dart
File metadata and controls
43 lines (38 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2019 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
class CodeStyle extends InheritedWidget {
const CodeStyle({
this.baseStyle,
this.numberStyle,
this.commentStyle,
this.keywordStyle,
this.stringStyle,
this.punctuationStyle,
this.classStyle,
this.constantStyle,
@required Widget child,
}) : super(child: child);
final TextStyle baseStyle;
final TextStyle numberStyle;
final TextStyle commentStyle;
final TextStyle keywordStyle;
final TextStyle stringStyle;
final TextStyle punctuationStyle;
final TextStyle classStyle;
final TextStyle constantStyle;
static CodeStyle of(BuildContext context) {
return context.dependOnInheritedWidgetOfExactType<CodeStyle>();
}
@override
bool updateShouldNotify(CodeStyle oldWidget) =>
oldWidget.baseStyle != baseStyle ||
oldWidget.numberStyle != numberStyle ||
oldWidget.commentStyle != commentStyle ||
oldWidget.keywordStyle != keywordStyle ||
oldWidget.stringStyle != stringStyle ||
oldWidget.punctuationStyle != punctuationStyle ||
oldWidget.classStyle != classStyle ||
oldWidget.constantStyle != constantStyle;
}