Skip to content

Instantly share code, notes, and snippets.

View daiki1003's full-sized avatar
🏠
Working from home

ashdik daiki1003

🏠
Working from home
View GitHub Profile
@daiki1003
daiki1003 / scroll_view_under_container.dart
Created November 27, 2020 10:16
scroll_view_under_container
class ScrollViewUnderContainer extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
Expanded(
child: ListView(
children: [
for (int i = 0; i < 100; i++)
@daiki1003
daiki1003 / user_providers.dart
Last active January 4, 2021 14:09
Is this the best way...?
class Tweet {
final String id;
final String content;
}
// Three response classes includes tweets.
class FeedResponse {
final List<Tweet> tweets;
}
bool nullableBoolean() {
return null;
}
void main() {
final nullable = nullableBoolean();
if (nullable == false) {
print('aa');
} else {
print('bb');
@daiki1003
daiki1003 / sample_clear.dart
Created July 19, 2021 06:23
Sample for Riverpod
final authStateProvider = StateProvider<bool>(
(ref) => false,
);
final notificationsStateProvider = StateProvider<List<Notification>?>(
(ref) {
final authorized = ref.watch(authStateProvider).state;
if (authorized) {
// return ?
}
class SampleScreen extends StatefulWidget {
const SampleScreen({
Key? key,
}) : super(key: key);
@override
_SampleScreenState createState() => _SampleScreenState();
}
class _SampleScreenState extends State<SampleScreen> {
- name: 'Setup flutter environment'
uses: subosito/flutter-action@v2
with:
flutter-version: '2.10.3'
channel: 'stable'
cache: true # これ
- name: Cache pubspec dependencies
uses: actions/cache@v2
with:
path: |
${{ env.FLUTTER_HOME }}/.pub-cache
**/.packages
**/.flutter-plugins
**/.flutter-plugin-dependencies
**/.dart_tool/package_config.json
key: build-pubspec-${{ hashFiles('**/pubspec.lock') }}
- name: Cache build runner
uses: actions/cache@v2
with:
path: |
**/.dart_tool/build
key: build-runner-${{ hashFiles('**/asset_graph.json') }}-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
build-runner-
- name: 'Setup flutter environment'
uses: subosito/flutter-action@v2
with:
flutter-version: '2.10.3'
channel: 'stable'
cache: true
- name: 'Cache pubspec dependencies'
uses: actions/cache@v2
with:
class MyGreatestWidget extends StatelessWidget {
const MyGreatestWidget({
Key? key,
required this.onPressed,
}) : super(key: key);
final ValueCallback<String> onPressed;
@override
Widget build(BuildContext context) {