Skip to content

Instantly share code, notes, and snippets.

View Zambrella's full-sized avatar

Doug Todd Zambrella

View GitHub Profile
@Zambrella
Zambrella / animated_button.dart
Created June 3, 2022 14:42
A custom animated button in Flutter
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stash_hub/presentation/profile/logic/delete_account_states.dart';
import 'package:theme/theme.dart';
import '../../../repositories/authentication_repository.dart';
import '../logic/delete_account_notifier.dart';
class AccountDeleteModalContent extends ConsumerStatefulWidget {
const AccountDeleteModalContent({Key? key}) : super(key: key);
void main() async {
WidgetsFlutterBinding.ensureInitialized();
final container = ProviderContainer();
final routerDelegate = createDelegate(container.read);
final routeInformationParser = BeamerParser();
F.appFlavor = Flavor.DEV;
await Firebase.initializeApp();
part 'zambrella/zambrella_widget.dart';
part 'goober0329/goober_widget.dart';
part 'rift/rift_widget.dart';
part 'slovnicki/slovnicki_widget.dart';
part 'hsinats/hsinats_widget.dart';
// part 'example/example.dart'; <-- here
List<WidgetInfo> widgetInfoList = [
zambrella,
goober,
part of user_widgets;
class ExampleInfo extends WidgetInfo {
get name => 'My Widget'; //name your widget, not used in design currently
get description => "This is an example of a basic widget";
get developer => "Joey Marino"; //use any name for yourself
get logoPath => "assets/profile_logos/flutter_buddy.png";
get widget => ExampleWidget();
}
@Zambrella
Zambrella / sudoku.dart
Created November 24, 2020 19:41
Algorithm to solve sudoku puzzles
import 'package:flutter/material.dart';
import 'package:sudoku_solver/constants/enums.dart';
import 'package:sudoku_solver/models/board_square.dart';
import 'package:sudoku_solver/models/position_model.dart';
import 'dart:async';
import 'package:flutter/foundation.dart';
class SudokuGrid extends ChangeNotifier {
List<List<BoardSquare>> userBoard;
int width;
class EntryListModel extends ChangeNotifier {
List<Entry2> entryList = <Entry2>[];
void addNewEntry(EntryType entryType) {
entryList.add(Entry2(entryType));
notifyListeners();
}
void deleteEntry(String id) {
entryList.removeWhere((element) => element.id == id);
void main() {
BM newBM = BM(amount: 3, discomfort: 5, bristolScale: 3, name: 'Cool name', submittedTime: 'Thursday');
print(newBM.amount);
print(newBM.name);
}
@Zambrella
Zambrella / extends.dart
Created August 15, 2020 22:05
Help plz
abstract class Entry {
String name;
Entry(this.name);
void something();
}
@Zambrella
Zambrella / main.dart
Created October 22, 2019 21:42
For Jesal
void main() {
Sample newSample = Sample();
print(newSample.counts);
void setToZero () {
// for (var i = 0; i < newSample.counts.length; i++) {
// newSample.counts[i] = 0;
// }
@Zambrella
Zambrella / spinner.dart
Created September 29, 2019 11:46
Function to return a spinner widget or text depending of the page is still loading
// Function to return either a spinner or some text depending on whether a result is available
Widget loadingSpinner() {
if (loading == true) {
return SpinKitDoubleBounce(
color: Colors.red,
size: 50,
);
} else {
return Text(
'$userPercentage%',