-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(readme): Add readme loading support
- Loading branch information
Showing
11 changed files
with
234 additions
and
38 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
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
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
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
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
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
44 changes: 44 additions & 0 deletions
44
frontend/lib/ui/pages/repository_details/widets/readme_container.dart
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,44 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_markdown/flutter_markdown.dart'; | ||
import 'package:get/get.dart'; | ||
import 'package:markdown/markdown.dart' as md; | ||
import '../../../molecules/load_page_error.dart'; | ||
|
||
import '../repository_details_page.dart'; | ||
|
||
/// Controls exhibition of the repository readme | ||
/// [RepositoryDetailsController] is required to be injected. | ||
class ReadmeContainer extends GetView<RepositoryDetailsController> { | ||
@override | ||
Widget build(BuildContext context) { | ||
if (controller.showReadmeLoading.value || true) { | ||
return const Center(child: CircularProgressIndicator()); | ||
} | ||
|
||
if (controller.readmeLoadError.value) { | ||
return const LoadPageError(); | ||
} | ||
|
||
final readmeContents = controller.readmeContents.value; | ||
final theme = Theme.of(context); | ||
|
||
return DecoratedBox( | ||
decoration: BoxDecoration( | ||
borderRadius: BorderRadius.circular(4), | ||
border: Border.all( | ||
color: theme.dividerColor, | ||
width: theme.dividerTheme.thickness ?? 1, | ||
)), | ||
child: Padding( | ||
padding: const EdgeInsets.symmetric( | ||
vertical: 16.0, | ||
horizontal: 32.0, | ||
), | ||
child: MarkdownBody( | ||
data: readmeContents, | ||
extensionSet: md.ExtensionSet.gitHubWeb, | ||
), | ||
), | ||
); | ||
} | ||
} |
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
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
Oops, something went wrong.