update codeview

master
张萌 3 years ago
parent 6ead6aced6
commit 6275a97ed4

@ -26,8 +26,8 @@ class CodeStyle extends InheritedWidget {
final TextStyle? classStyle; final TextStyle? classStyle;
final TextStyle? constantStyle; final TextStyle? constantStyle;
static CodeStyle? of(BuildContext context) { static CodeStyle of(BuildContext context) {
return context.dependOnInheritedWidgetOfExactType<CodeStyle>(); return context.dependOnInheritedWidgetOfExactType<CodeStyle>()!;
} }
@override @override
@ -40,4 +40,4 @@ class CodeStyle extends InheritedWidget {
oldWidget.punctuationStyle != punctuationStyle || oldWidget.punctuationStyle != punctuationStyle ||
oldWidget.classStyle != classStyle || oldWidget.classStyle != classStyle ||
oldWidget.constantStyle != constantStyle; oldWidget.constantStyle != constantStyle;
} }

@ -1,6 +1,9 @@
import 'package:ansu_ui/ansu_ui.dart'; import 'package:ansu_ui/ansu_ui.dart';
import 'package:ansu_ui/chart/circle_chart_widget.dart'; import 'package:ansu_ui/chart/circle_chart_widget.dart';
import 'package:example/codeviewer/code_segments.dart';
import 'package:example/common/code_view.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart';
class ExampleChart extends StatefulWidget { class ExampleChart extends StatefulWidget {
const ExampleChart({Key? key}) : super(key: key); const ExampleChart({Key? key}) : super(key: key);
@ -14,6 +17,14 @@ class _ExampleChartState extends State<ExampleChart> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ASScaffold( return ASScaffold(
title: 'chart', title: 'chart',
actions: [
IconButton(
icon: Icon(Icons.code, color: Colors.black54),
onPressed: () => Get.to(CodeView(
text: (context) => CodeSegments.button(context),
)),
),
],
body: ListView( body: ListView(
children: [ children: [
20.hb, 20.hb,

@ -1,6 +1,9 @@
import 'package:ansu_ui/ansu_ui.dart'; import 'package:ansu_ui/ansu_ui.dart';
import 'package:ansu_ui/divider/as_dotted_divider.dart'; import 'package:ansu_ui/divider/as_dotted_divider.dart';
import 'package:example/codeviewer/code_segments.dart';
import 'package:example/common/code_view.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart';
class ExampleDivider extends StatefulWidget { class ExampleDivider extends StatefulWidget {
ExampleDivider({Key? key}) : super(key: key); ExampleDivider({Key? key}) : super(key: key);
@ -14,6 +17,14 @@ class _ExampleDividerState extends State<ExampleDivider> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ASScaffold( return ASScaffold(
title: '分割线', title: '分割线',
actions: [
IconButton(
icon: Icon(Icons.code, color: Colors.black54),
onPressed: () => Get.to(CodeView(
text: (context) => CodeSegments.button(context),
)),
),
],
body: Center( body: Center(
child: Column( child: Column(
children: [ children: [
@ -49,7 +60,6 @@ class _ExampleDividerState extends State<ExampleDivider> {
ASDottedDivider.horizontal( ASDottedDivider.horizontal(
color: Colors.black, color: Colors.black,
), ),
Container( Container(
height: 100.w, height: 100.w,
child: Row( child: Row(

Loading…
Cancel
Save