This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
print(roundHalfEven(4.5)); // 4 | |
print(roundHalfEven(3.5)); // 4 | |
print(roundHalfEven(4.500001)); // 5 | |
print(roundHalfEven(3.500001)); // 4 | |
print('-------'); | |
print(roundHalfEven(-4.5)); //- 4 | |
print(roundHalfEven(-3.5)); //- 4 | |
print(roundHalfEven(-4.500001)); //- 5 | |
print(roundHalfEven(-3.500001)); //- 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
var jsondata = [ | |
{ | |
'value': '1', | |
'label': 'Red', | |
}, | |
{ | |
'value': '2', | |
'label': 'Green', | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:dio/dio.dart'; | |
import 'package:flutter_bili_app/http/core/hi_adapter.dart'; | |
import 'package:flutter_bili_app/http/core/hi_error.dart'; | |
import 'package:flutter_bili_app/http/request/base_request.dart'; | |
/// Dio 適配器 | |
class DioAdapter extends HiNetAdapter { | |
@override | |
Future<HiNetResponse<T>> send<T>(BaseRequest request) async { | |
var response, options = Options(headers: request.header); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:io'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/services.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends AppCompatActivity { | |
private static final int ROOT_VIEW = 650; | |
private static final int CUSTOM_VIEW = 823; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
ConstraintLayout constraintLayout = new ConstraintLayout(this); | |
constraintLayout.setId(ROOT_VIEW); | |
addContentView(constraintLayout, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ConstraintLayoutBehavior extends CoordinatorLayout.Behavior<ConstraintLayout> { | |
public ConstraintLayoutBehavior(Context context, AttributeSet attributeSet) { | |
super(context, attributeSet); | |
} | |
@Override | |
public boolean layoutDependsOn(CoordinatorLayout parent, ConstraintLayout child, View dependency) { | |
return dependency instanceof Snackbar.SnackbarLayout; | |
} |