-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
3,988 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Miscellaneous | ||
*.class | ||
*.log | ||
*.pyc | ||
*.swp | ||
.DS_Store | ||
.atom/ | ||
.buildlog/ | ||
.history | ||
.svn/ | ||
|
||
# IntelliJ related | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ | ||
|
||
# The .vscode folder contains launch configuration and tasks you configure in | ||
# VS Code which you may wish to be included in version control, so this line | ||
# is commented out by default. | ||
#.vscode/ | ||
|
||
# Flutter/Dart/Pub related | ||
**/doc/api/ | ||
**/ios/Flutter/.last_build_id | ||
.dart_tool/ | ||
.flutter-plugins | ||
.flutter-plugins-dependencies | ||
.packages | ||
.pub-cache/ | ||
.pub/ | ||
/build/ | ||
|
||
# Web related | ||
lib/generated_plugin_registrant.dart | ||
|
||
# Symbolication related | ||
app.*.symbols | ||
|
||
# Obfuscation related | ||
app.*.map.json | ||
|
||
# Android Studio will place build artifacts here | ||
/android/app/debug | ||
/android/app/profile | ||
/android/app/release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# This file tracks properties of this Flutter project. | ||
# Used by Flutter tool to assess capabilities and perform upgrades etc. | ||
# | ||
# This file should be version controlled and should not be manually edited. | ||
|
||
version: | ||
revision: 25134a16d128ed22dc0ad8d41d2b931fcad3b014 | ||
channel: master | ||
|
||
project_type: app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# text_composition_example | ||
|
||
Demonstrates how to use the text_composition plugin. | ||
|
||
## Getting Started | ||
|
||
This project is a starting point for a Flutter application. | ||
|
||
A few resources to get you started if this is your first Flutter project: | ||
|
||
- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) | ||
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) | ||
|
||
For help getting started with Flutter, view our | ||
[online documentation](https://flutter.dev/docs), which offers tutorials, | ||
samples, guidance on mobile development, and a full API reference. |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:text_composition/text_composition.dart'; | ||
|
||
import 'first_chapter.dart'; | ||
|
||
main(List<String> args) { | ||
runApp(MaterialApp(home: Home())); | ||
} | ||
|
||
class Home extends StatelessWidget { | ||
const Home({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
body: TextButton( | ||
child: Text("开"), | ||
onPressed: () => Navigator.of(context).push( | ||
MaterialPageRoute(builder: (BuildContext context) => Page()), | ||
), | ||
), | ||
); | ||
} | ||
} | ||
|
||
class Page extends StatelessWidget { | ||
const Page({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final start = DateTime.now(); | ||
final tc = TextComposition( | ||
paragraphs: first_chapter, | ||
boxHeight: 500, | ||
boxWidth: 320, | ||
); | ||
final end = DateTime.now(); | ||
final style = TextStyle(color: Colors.white); | ||
return Scaffold( | ||
body: Container( | ||
color: Colors.deepPurple, | ||
width: 320 + 30, | ||
child: Column( | ||
children: [ | ||
Text("开始时间 $start", style: style), | ||
Text("结束时间 $end", style: style), | ||
Expanded( | ||
child: ListView.separated( | ||
separatorBuilder: (context, index) => Container( | ||
height: 20, | ||
color: Colors.teal, | ||
child: Text("页数 ${index + 1} / ${tc.pageCount}", style: style), | ||
), | ||
itemCount: tc.pageCount, | ||
itemBuilder: (BuildContext context, int index) { | ||
return SizedBox( | ||
height: 500, | ||
child: Row( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Column( | ||
children: List.generate( | ||
500 ~/ 20, | ||
(index) => Container( | ||
height: 20, | ||
width: 30, | ||
color: Colors.primaries[index % Colors.primaries.length], | ||
child: Text( | ||
((index + 1) * 20).toString(), | ||
textAlign: TextAlign.end, | ||
style: TextStyle(color: Colors.white), | ||
), | ||
), | ||
)), | ||
Expanded(child: RichText(text: tc.getPageView(tc.pages[index]))), | ||
], | ||
), | ||
); | ||
}, | ||
), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
# Generated by pub | ||
# See https://dart.dev/tools/pub/glossary#lockfile | ||
packages: | ||
async: | ||
dependency: transitive | ||
description: | ||
name: async | ||
url: "https://pub.flutter-io.cn" | ||
source: hosted | ||
version: "2.5.0-nullsafety.3" | ||
boolean_selector: | ||
dependency: transitive | ||
description: | ||
name: boolean_selector | ||
url: "https://pub.flutter-io.cn" | ||
source: hosted | ||
version: "2.1.0-nullsafety.3" | ||
characters: | ||
dependency: transitive | ||
description: | ||
name: characters | ||
url: "https://pub.flutter-io.cn" | ||
source: hosted | ||
version: "1.1.0-nullsafety.5" | ||
charcode: | ||
dependency: transitive | ||
description: | ||
name: charcode | ||
url: "https://pub.flutter-io.cn" | ||
source: hosted | ||
version: "1.2.0-nullsafety.3" | ||
clock: | ||
dependency: transitive | ||
description: | ||
name: clock | ||
url: "https://pub.flutter-io.cn" | ||
source: hosted | ||
version: "1.1.0-nullsafety.3" | ||
collection: | ||
dependency: transitive | ||
description: | ||
name: collection | ||
url: "https://pub.flutter-io.cn" | ||
source: hosted | ||
version: "1.15.0-nullsafety.5" | ||
fake_async: | ||
dependency: transitive | ||
description: | ||
name: fake_async | ||
url: "https://pub.flutter-io.cn" | ||
source: hosted | ||
version: "1.2.0-nullsafety.3" | ||
flutter: | ||
dependency: "direct main" | ||
description: flutter | ||
source: sdk | ||
version: "0.0.0" | ||
flutter_test: | ||
dependency: "direct dev" | ||
description: flutter | ||
source: sdk | ||
version: "0.0.0" | ||
matcher: | ||
dependency: transitive | ||
description: | ||
name: matcher | ||
url: "https://pub.flutter-io.cn" | ||
source: hosted | ||
version: "0.12.10-nullsafety.3" | ||
meta: | ||
dependency: transitive | ||
description: | ||
name: meta | ||
url: "https://pub.flutter-io.cn" | ||
source: hosted | ||
version: "1.3.0-nullsafety.6" | ||
path: | ||
dependency: transitive | ||
description: | ||
name: path | ||
url: "https://pub.flutter-io.cn" | ||
source: hosted | ||
version: "1.8.0-nullsafety.3" | ||
sky_engine: | ||
dependency: transitive | ||
description: flutter | ||
source: sdk | ||
version: "0.0.99" | ||
source_span: | ||
dependency: transitive | ||
description: | ||
name: source_span | ||
url: "https://pub.flutter-io.cn" | ||
source: hosted | ||
version: "1.8.0-nullsafety.4" | ||
stack_trace: | ||
dependency: transitive | ||
description: | ||
name: stack_trace | ||
url: "https://pub.flutter-io.cn" | ||
source: hosted | ||
version: "1.10.0-nullsafety.6" | ||
stream_channel: | ||
dependency: transitive | ||
description: | ||
name: stream_channel | ||
url: "https://pub.flutter-io.cn" | ||
source: hosted | ||
version: "2.1.0-nullsafety.3" | ||
string_scanner: | ||
dependency: transitive | ||
description: | ||
name: string_scanner | ||
url: "https://pub.flutter-io.cn" | ||
source: hosted | ||
version: "1.1.0-nullsafety.3" | ||
term_glyph: | ||
dependency: transitive | ||
description: | ||
name: term_glyph | ||
url: "https://pub.flutter-io.cn" | ||
source: hosted | ||
version: "1.2.0-nullsafety.3" | ||
test_api: | ||
dependency: transitive | ||
description: | ||
name: test_api | ||
url: "https://pub.flutter-io.cn" | ||
source: hosted | ||
version: "0.2.19-nullsafety.6" | ||
text_composition: | ||
dependency: "direct main" | ||
description: | ||
path: ".." | ||
relative: true | ||
source: path | ||
version: "0.0.1" | ||
typed_data: | ||
dependency: transitive | ||
description: | ||
name: typed_data | ||
url: "https://pub.flutter-io.cn" | ||
source: hosted | ||
version: "1.3.0-nullsafety.5" | ||
vector_math: | ||
dependency: transitive | ||
description: | ||
name: vector_math | ||
url: "https://pub.flutter-io.cn" | ||
source: hosted | ||
version: "2.1.0-nullsafety.5" | ||
sdks: | ||
dart: ">=2.12.0-0.0 <3.0.0" | ||
flutter: ">=1.17.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: text_composition_example | ||
description: Demonstrates how to use the text_composition plugin. | ||
|
||
# The following line prevents the package from being accidentally published to | ||
# pub.dev using `pub publish`. This is preferred for private packages. | ||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev | ||
|
||
environment: | ||
sdk: ">=2.12.0-0 <3.0.0" | ||
|
||
dependencies: | ||
flutter: | ||
sdk: flutter | ||
|
||
text_composition: | ||
# When depending on this package from a real application you should use: | ||
# text_composition2: ^x.y.z | ||
# See https://dart.dev/tools/pub/dependencies#version-constraints | ||
# The example app is bundled with the plugin so we use a path dependency on | ||
# the parent directory to use the current plugin's version. | ||
path: ../ | ||
|
||
dev_dependencies: | ||
flutter_test: | ||
sdk: flutter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
flutter/ephemeral/ | ||
|
||
# Visual Studio user-specific files. | ||
*.suo | ||
*.user | ||
*.userosscache | ||
*.sln.docstates | ||
|
||
# Visual Studio build-related files. | ||
x64/ | ||
x86/ | ||
|
||
# Visual Studio cache files | ||
# files ending in .cache can be ignored | ||
*.[Cc]ache | ||
# but keep track of directories ending in .cache | ||
!*.[Cc]ache/ |
Oops, something went wrong.