A GitLab client by Flutter

admin

Flutter for GitLab. Support Android & IOS

Flutter4GitLab

Flutter for GitLab. Support Android & IOS.

Features

  • App
    •  Login by Personal Access Token
    •  Projects
    •  Themes mode
    •  Markdown and code highlighting support
    •  Search Users/Orgs, Repos, Issues/MRs & Code.
  • Repositories
    •  Edit, Create & Delete files (commit)
    •  Edit, Create & Delete files (Project Columns Cards)
    •  Search Repos
    •  Browse and search Repos
    •  See your public, private and forked Repos
    •  Filter Branches and Commits
  • Issues and Pull Requests
    •  Search Issues/MRs
    •  Filter Issues/MRs
    •  Open/close Issues/MRs
    •  Comment on Issues/MRs
    •  Manage Issue/PR comments
    •  Edit Issues/MRs
    •  Assign people and add Labels and Milestones to Issues/MRs
    •  Merge MRs
    •  MRs request review changes/approve & comment.
    •  MRs statuses
    •  Approve or UnApprove MR
    •  CI Status
    •  Play|Cancel|Retry CI Job
  • Organisations
    •  Feeds
    •  Repos
  • PipeLines
    •  List project’s pipepine
    •  Play, Retry, Cancel Pipeline Job

Usage

GitlabClient _client = GitlabClient.newInstance();
final url = "";
final remoteData = await _client
        .get(url)
        .then((resp) {
          page = int.tryParse(resp.headers['x-page'] ?? 0);
          total = int.tryParse(resp.headers['x-total-pages'] ?? 0);
          next = int.tryParse(resp.headers['x-next-page'] ?? 0);
          return resp;
        })
        .then((resp) => utf8.decode(resp.bodyBytes))
        .then((s) => jsonDecode(s))
        .catchError((err) {
          print("loadData err: $err");
          return [];
        })
        .whenComplete(_client.close);
    return remoteData;
/// remoteData: Object or List

CommListView

It is a common component that contains some logics. as follows:

  • Automatically load data
  • Pull down to refresh
  • Pull up page load
///[canPullUp] This bool will affect whether or not to have the function of drop-up load
///[canPullDown] This bool will affect whether or not to have the function of drop-down refresh
///[withPage] Tihs bool will affect whether or not to add page arg to request url
abstract class CommListWidget extends StatefulWidget {
  final bool canPullUp;

  final bool canPullDown;

  final bool withPage;

  CommListWidget(
      {this.canPullDown = true, this.canPullUp = true, this.withPage = true});
}

Usage

/// Create a list statefull widget

class ProjectTab extends CommListWidget {
  final String type;

  ProjectTab(this.type);

  @override
  State<StatefulWidget> createState() => ProjectState(
      "projects?order_by=updated_at&per_page=10&simple=true&$type");
}

/// Create a state for list

class ProjectState extends CommListState {
  ProjectState(String endPoint) : super(endPoint);

  @override
  Widget childBuild(BuildContext context, int index) {
    final item = data[index];
    return Card(...);
  }
}
 

Screenshots

Light Dark
First Sec
Repo Merge Request
Third Fourth
Groups Jobs
Five Six


Credit (github url) : https://github.com/stefanJi/Flutter4GitLab

Next Article : https://flutterappdev.com/2019/01/25/a-flutter-plugin-to-crop-image-on-ios-and-android-mobile-app-dev/

Leave a Comment