|
| 1 | +import 'package:example/themes/github_theme.dart'; |
| 2 | +import 'package:flutter/material.dart'; |
| 3 | +import 'package:flutter_timeline/flutter_timeline.dart'; |
| 4 | + |
| 5 | +class GithubActivityDemo extends StatefulWidget { |
| 6 | + static const routeName = "/demo/github-activity"; |
| 7 | + |
| 8 | + @override |
| 9 | + State<StatefulWidget> createState() => _GithubActivityDemoState(); |
| 10 | +} |
| 11 | + |
| 12 | +class _GithubActivityDemoState extends State<GithubActivityDemo> { |
| 13 | + @override |
| 14 | + Widget build(BuildContext context) { |
| 15 | + return Theme(data: makeGithubTheme(), child: buildScreen()); |
| 16 | + } |
| 17 | + |
| 18 | + Widget buildScreen() { |
| 19 | + return Scaffold( |
| 20 | + appBar: AppBar( |
| 21 | + title: Text("github"), |
| 22 | + ), |
| 23 | + body: buildBody(), |
| 24 | + ); |
| 25 | + } |
| 26 | + |
| 27 | + Widget buildBody() { |
| 28 | + return SingleChildScrollView( |
| 29 | + child: Column( |
| 30 | + children: [buildTimeline()], |
| 31 | + ), |
| 32 | + ); |
| 33 | + } |
| 34 | + |
| 35 | + Widget buildTimeline() { |
| 36 | + return Timeline(events: [TimelineEventDisplay(child: Text("wow"))]); |
| 37 | + } |
| 38 | +} |
| 39 | + |
| 40 | +/// github's timeline card (the embedded type of card, not event itself) |
| 41 | +/// <div class="profile-timeline-card bg-white border border-gray-dark rounded-1 p-3"> |
| 42 | +/// <svg class="octicon octicon-issue-closed closed d-inline-block mt-1 float-left" title="Closed" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M1.5 8a6.5 6.5 0 0110.65-5.003.75.75 0 00.959-1.153 8 8 0 102.592 8.33.75.75 0 10-1.444-.407A6.5 6.5 0 011.5 8zM8 12a1 1 0 100-2 1 1 0 000 2zm0-8a.75.75 0 01.75.75v3.5a.75.75 0 11-1.5 0v-3.5A.75.75 0 018 4zm4.78 4.28l3-3a.75.75 0 00-1.06-1.06l-2.47 2.47-.97-.97a.749.749 0 10-1.06 1.06l1.5 1.5a.75.75 0 001.06 0z"></path></svg> |
| 43 | +/// <div class="ml-4"> |
| 44 | +/// <h3 class="lh-condensed my-0"> |
| 45 | +/// <a class="text-gray-dark" data-hovercard-type="issue" data-hovercard-url="/nuxt/content/issues/339/hovercard" href="/nuxt/content/issues/339">use content theme on existing nuxt project</a> |
| 46 | +/// </h3> |
| 47 | +/// |
| 48 | +/// <div class="text-gray mb-0 mt-2 "> |
| 49 | +/// <p><a href="https://github.com/nuxt/content/edit/dev/docs/content/en/themes-docs.md">https://github.com/nuxt/content/edit/dev/docs/content/en/themes-docs.md</a> |
| 50 | +///this example is outdated and wont work. |
| 51 | +///<span class="pl-k">import</span> <span class="pl-s1">theme</span> <span class="pl-k">from</span> <span class="pl-s">'@nuxt/content-th…</span></p> |
| 52 | +/// </div> |
| 53 | +/// |
| 54 | +/// <div class="f6 text-gray mt-2"> |
| 55 | +/// 10 |
| 56 | +/// comments |
| 57 | +/// </div> |
| 58 | +/// </div> |
| 59 | +/// </div> |
| 60 | +class TimelineCard extends StatelessWidget { |
| 61 | + @override |
| 62 | + Widget build(BuildContext context) { |
| 63 | + return Container( |
| 64 | + decoration: BoxDecoration(), |
| 65 | + ); |
| 66 | + } |
| 67 | +} |
| 68 | + |
| 69 | +/// a indicator used at github activity timeline |
| 70 | +/// <span class="discussion-item-icon"> |
| 71 | +/// <svg class="octicon octicon-eye" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M1.679 7.932c.412-.621 1.242-1.75 2.366-2.717C5.175 4.242 6.527 3.5 8 3.5c1.473 0 2.824.742 3.955 1.715 1.124.967 1.954 2.096 2.366 2.717a.119.119 0 010 .136c-.412.621-1.242 1.75-2.366 2.717C10.825 11.758 9.473 12.5 8 12.5c-1.473 0-2.824-.742-3.955-1.715C2.92 9.818 2.09 8.69 1.679 8.068a.119.119 0 010-.136zM8 2c-1.981 0-3.67.992-4.933 2.078C1.797 5.169.88 6.423.43 7.1a1.619 1.619 0 000 1.798c.45.678 1.367 1.932 2.637 3.024C4.329 13.008 6.019 14 8 14c1.981 0 3.67-.992 4.933-2.078 1.27-1.091 2.187-2.345 2.637-3.023a1.619 1.619 0 000-1.798c-.45-.678-1.367-1.932-2.637-3.023C11.671 2.992 9.981 2 8 2zm0 8a2 2 0 100-4 2 2 0 000 4z"></path></svg> |
| 72 | +/// </span> |
| 73 | +class DiscussionItemIcon extends StatelessWidget { |
| 74 | + @override |
| 75 | + Widget build(BuildContext context) { |
| 76 | + return Container( |
| 77 | + decoration: BoxDecoration( |
| 78 | + borderRadius: BorderRadius.all(Radius.circular(32)), |
| 79 | + color: Colors.grey), |
| 80 | + child: Icon(Icons.fiber_manual_record), |
| 81 | + ); |
| 82 | + } |
| 83 | +} |
| 84 | + |
| 85 | +/// timeline date indicator by github |
| 86 | +/// <h3 class="profile-timeline-month-heading bg-white d-inline-block h6 pr-2 py-1"> |
| 87 | +/// August <span class="text-gray">2020</span> |
| 88 | +/// </h3> |
| 89 | +class TimelineMonthHeading extends StatelessWidget { |
| 90 | + @override |
| 91 | + Widget build(BuildContext context) { |
| 92 | + return Text( |
| 93 | + "data", |
| 94 | + style: Theme.of(context).textTheme.headline3, |
| 95 | + ); |
| 96 | + } |
| 97 | +} |
0 commit comments