Skip to content

Instantly share code, notes, and snippets.

View Mastersam07's full-sized avatar
๐Ÿš€
building amazing things

Samuel Abada Mastersam07

๐Ÿš€
building amazing things
View GitHub Profile
@Mastersam07
Mastersam07 / future.dart
Last active March 27, 2024 19:41
Future controller idea
import 'package:flutter/material.dart';
typedef FutureGenerator<T> = Future<T> Function();
class FutureController<T> {
Future<T>? _future;
VoidCallback? _onUpdate;
final FutureGenerator<T>? _futureGenerator;
FutureController({FutureGenerator<T>? futureGenerator})
@Mastersam07
Mastersam07 / bottom_sheet.dart
Created February 1, 2024 18:24 — forked from slightfoot/bottom_sheet.dart
Modal Bottom Sheet with Input Fields fix for Flutter (Fix issue with overlap with keyboard and fix for tapping to dismiss)
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
@Mastersam07
Mastersam07 / ci.yaml
Created December 10, 2023 18:28
Yaml to build and upload apk to diawi
name: CI
on:
push:
branches: [master, staging]
paths:
- 'lib/**'
- 'pubspec.yaml'
- '.github/**'
- 'android/**'
@Mastersam07
Mastersam07 / auto_response.yaml
Last active October 26, 2023 07:18
Automated Responses Github Actions
name: Automated Responses
on:
issues:
types: [opened]
pull_request:
types: [opened]
jobs:
respond:
@Mastersam07
Mastersam07 / listop.dart
Last active October 12, 2023 09:09
Some operation on list
extension EfficientList<T> on List<T> {
List<List<T>> splitBy(Iterable<T> separator) {
List<List<T>> result = [];
List<T> current = [];
int i = 0;
while (i < length) {
bool isMatch = true;
for (int j = 0; j < separator.length; j++) {
if (i + j >= length || this[i + j] != separator.elementAt(j)) {
isMatch = false;
@Mastersam07
Mastersam07 / see_more.dart
Created September 19, 2023 18:57
See more text
import 'package:expandable/expandable.dart';
import 'package:flutter/material.dart';
import 'package:linkable/linkable.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@Mastersam07
Mastersam07 / text_theme.dart
Last active September 9, 2023 09:25
Theme extensions for text styles
import 'package:flutter/material.dart';
@immutable
class AppTextTheme extends ThemeExtension<AppTextTheme> {
final TextStyle? headline01;
final TextStyle? headline02;
final TextStyle? headline03;
final TextStyle? headline04;
final TextStyle? headline05;
final TextStyle? title01;
@Mastersam07
Mastersam07 / challenge.dart
Created August 26, 2023 15:00
Array challenge
// Have the function ArrayChallenge(strArr)
// read the array of strings stored in strArr, which will contain 2 elements:
// the first element will be a sequence of characters,
// and the second element will be a long string of comma-separated words, in alphabetical order,
// that represents a dictionary of some arbitrary length.
// For example: strArr can be: ["hellocat", "apple,bat,cat,goodbye,hello,yellow,why"].
// Your goal is to determine if the first element in the input can be split into two words,
// where both words exist in the dictionary that is provided in the second input.
// In this example, the first element can be split into two words:
// hello and cat because both of those words are in the dictionary.
@Mastersam07
Mastersam07 / infinite_scroll.dart
Created August 13, 2023 20:54
Infinite scroll horizontal list
class InfiniteScrollText extends StatefulWidget {
@override
_InfiniteScrollTextState createState() => _InfiniteScrollTextState();
}
class _InfiniteScrollTextState extends State<InfiniteScrollText>
with TickerProviderStateMixin {
late ScrollController _controller;
late AnimationController _animationController;
@Mastersam07
Mastersam07 / radial_layout.dart
Last active July 26, 2023 09:24
Radial layout
import 'dart:math';
import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
home: RadialMenu(),
),
);