From 6275a97ed4d960ff662b186e6d46436cd1fb7f08 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Tue, 31 Aug 2021 09:39:46 +0800 Subject: [PATCH] update codeview --- example/lib/codeviewer/code_style.dart | 6 +++--- example/lib/widgets/example_chart.dart | 11 +++++++++++ example/lib/widgets/example_divider.dart | 12 +++++++++++- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/example/lib/codeviewer/code_style.dart b/example/lib/codeviewer/code_style.dart index 8754484..22f3412 100644 --- a/example/lib/codeviewer/code_style.dart +++ b/example/lib/codeviewer/code_style.dart @@ -26,8 +26,8 @@ class CodeStyle extends InheritedWidget { final TextStyle? classStyle; final TextStyle? constantStyle; - static CodeStyle? of(BuildContext context) { - return context.dependOnInheritedWidgetOfExactType(); + static CodeStyle of(BuildContext context) { + return context.dependOnInheritedWidgetOfExactType()!; } @override @@ -40,4 +40,4 @@ class CodeStyle extends InheritedWidget { oldWidget.punctuationStyle != punctuationStyle || oldWidget.classStyle != classStyle || oldWidget.constantStyle != constantStyle; -} \ No newline at end of file +} diff --git a/example/lib/widgets/example_chart.dart b/example/lib/widgets/example_chart.dart index 971c3f9..53d84c1 100644 --- a/example/lib/widgets/example_chart.dart +++ b/example/lib/widgets/example_chart.dart @@ -1,6 +1,9 @@ import 'package:ansu_ui/ansu_ui.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:get/get.dart'; class ExampleChart extends StatefulWidget { const ExampleChart({Key? key}) : super(key: key); @@ -14,6 +17,14 @@ class _ExampleChartState extends State { Widget build(BuildContext context) { return ASScaffold( title: 'chart', + actions: [ + IconButton( + icon: Icon(Icons.code, color: Colors.black54), + onPressed: () => Get.to(CodeView( + text: (context) => CodeSegments.button(context), + )), + ), + ], body: ListView( children: [ 20.hb, diff --git a/example/lib/widgets/example_divider.dart b/example/lib/widgets/example_divider.dart index 997e1f1..2227794 100644 --- a/example/lib/widgets/example_divider.dart +++ b/example/lib/widgets/example_divider.dart @@ -1,6 +1,9 @@ import 'package:ansu_ui/ansu_ui.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:get/get.dart'; class ExampleDivider extends StatefulWidget { ExampleDivider({Key? key}) : super(key: key); @@ -14,6 +17,14 @@ class _ExampleDividerState extends State { Widget build(BuildContext context) { return ASScaffold( title: '分割线', + actions: [ + IconButton( + icon: Icon(Icons.code, color: Colors.black54), + onPressed: () => Get.to(CodeView( + text: (context) => CodeSegments.button(context), + )), + ), + ], body: Center( child: Column( children: [ @@ -49,7 +60,6 @@ class _ExampleDividerState extends State { ASDottedDivider.horizontal( color: Colors.black, ), - Container( height: 100.w, child: Row(