Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format verse numbers #22

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>9.0</string>
<string>11.0</string>
</dict>
</plist>
13 changes: 8 additions & 5 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -127,7 +127,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -171,10 +171,12 @@
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
Expand All @@ -185,6 +187,7 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down Expand Up @@ -272,7 +275,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -346,7 +349,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -395,7 +398,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 2 additions & 0 deletions example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,7 @@
<false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
9 changes: 8 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,18 @@ class _HomePageState extends State<HomePage> {
void initState() {
super.initState();
_lyrics = '''

[C]Give me Freedom, [F]Give me fire
[Am]Give me reason, [G]Take me higher
[C]See the champions [F], Take the field now
[Am]Unify us, [G]make us feel proud


{soc}
[C]Celebration, [F]its around us
[Am]Unify us, [G]make us feel proud
{eoc}


[C]In the streets our, [F]hands are lifting
[Am]As we lose our, [G]inhibition
[C]Celebration, [F]its around us
Expand Down
2 changes: 1 addition & 1 deletion lib/src/chord_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class ChordProcessor {
final lastChordWidth = textWidth(lastChordText, chordStyle);
// final sizeOfThisChord = textWidth(_chordsSoFar, chordStyle);

double leadingSpace = max(0, sizeOfLeadingLyrics - lastChordWidth);
double leadingSpace = max(1, sizeOfLeadingLyrics - lastChordWidth - 15);

final transposedChord = chordTransposer.transposeChord(_chordsSoFar);

Expand Down
54 changes: 34 additions & 20 deletions lib/src/lyrics_renderer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class _LyricsRendererState extends State<LyricsRenderer> {
late TextStyle commentStyle;
bool _isChorus = false;
bool _isComment = false;
String? carry;

@override
void initState() {
Expand Down Expand Up @@ -163,31 +164,44 @@ class _LyricsRendererState extends State<LyricsRenderer> {
} else {
_isComment = false;
}

if (carry == null) {
if (int.tryParse(line.lyrics) != null) {
carry = '${line.lyrics} ';
return Container();
} else {
line.lyrics = ' ${line.lyrics}';
}
} else {
line.lyrics = carry! + line.lyrics;
carry = null;
}

return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (widget.showChord)
Row(
children: line.chords
.map((chord) => Row(
children: [
SizedBox(
width: chord.leadingSpace,
),
GestureDetector(
onTap: () =>
widget.onTapChord(chord.chordText),
child: RichText(
textScaleFactor: widget.scaleFactor,
text: TextSpan(
text: chord.chordText,
style: widget.chordStyle,
),
),
)
],
))
.toList(),
children: line.chords.map((chord) {
chord.chordText = ' ${chord.chordText}';
return Row(
children: [
SizedBox(
width: chord.leadingSpace,
),
GestureDetector(
onTap: () => widget.onTapChord(chord.chordText),
child: RichText(
textScaleFactor: widget.scaleFactor,
text: TextSpan(
text: chord.chordText,
style: widget.chordStyle,
),
),
)
],
);
}).toList(),
),
RichText(
textScaleFactor: widget.scaleFactor,
Expand Down
Loading