mirror of
https://github.com/flutter/samples.git
synced 2025-11-11 07:18:15 +00:00
[Gallery] Fix directory structure (#312)
This commit is contained in:
7
gallery/lib/codeviewer/code_displayer.dart
Normal file
7
gallery/lib/codeviewer/code_displayer.dart
Normal file
@@ -0,0 +1,7 @@
|
||||
// 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';
|
||||
|
||||
typedef TextSpan CodeDisplayer(BuildContext context);
|
||||
35877
gallery/lib/codeviewer/code_segments.dart
Normal file
35877
gallery/lib/codeviewer/code_segments.dart
Normal file
File diff suppressed because it is too large
Load Diff
43
gallery/lib/codeviewer/code_style.dart
Normal file
43
gallery/lib/codeviewer/code_style.dart
Normal file
@@ -0,0 +1,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;
|
||||
}
|
||||
Reference in New Issue
Block a user