mirror of
https://github.com/flutter/samples.git
synced 2026-06-25 23:58:44 +00:00
I got carried away with Gemini and basically rewrote CI and the release process for the new LLM reality. This work was largely completed by Gemini. - Bump all SDK versions to the current beta (3.9.0-0) - Run `flutter channel beta` - Wrote `ci_script.dart` to replace the bash scripts - Converted repository to pub workspace #2499 - Added llm.md and release.md - Added redirect for deprecated Samples Index ## Pre-launch Checklist - [x] I read the [Flutter Style Guide] _recently_, and have followed its advice. - [x] I signed the [CLA]. - [x] I read the [Contributors Guide]. - [x] I have added sample code updates to the [changelog]. - [x] I updated/added relevant documentation (doc comments with `///`).
48 lines
1.3 KiB
Dart
48 lines
1.3 KiB
Dart
// Copyright 2021, the Flutter project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import 'package:flutter/widgets.dart';
|
|
|
|
/// A mock authentication service
|
|
class BookstoreAuth extends ChangeNotifier {
|
|
bool _signedIn = false;
|
|
|
|
bool get signedIn => _signedIn;
|
|
|
|
Future<void> signOut() async {
|
|
await Future<void>.delayed(const Duration(milliseconds: 200));
|
|
// Sign out.
|
|
_signedIn = false;
|
|
notifyListeners();
|
|
}
|
|
|
|
Future<bool> signIn(String username, String password) async {
|
|
await Future<void>.delayed(const Duration(milliseconds: 200));
|
|
|
|
// Sign in. Allow any password.
|
|
_signedIn = true;
|
|
notifyListeners();
|
|
return _signedIn;
|
|
}
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
other is BookstoreAuth && other._signedIn == _signedIn;
|
|
|
|
@override
|
|
int get hashCode => _signedIn.hashCode;
|
|
|
|
static BookstoreAuth of(BuildContext context) => context
|
|
.dependOnInheritedWidgetOfExactType<BookstoreAuthScope>()!
|
|
.notifier!;
|
|
}
|
|
|
|
class BookstoreAuthScope extends InheritedNotifier<BookstoreAuth> {
|
|
const BookstoreAuthScope({
|
|
required super.notifier,
|
|
required super.child,
|
|
super.key,
|
|
});
|
|
}
|