Browse Source

remove jcenter

git@h5.yoqi.me 1 year ago
parent
commit
09a9a0e926

+ 3 - 9
README.md

@@ -2,15 +2,9 @@
 
 2048 game.
 
-## Getting Started
+## 功能
 
-This project is a starting point for a Flutter application.
+   * [ ] 响应式布局
+   * [x] 多国语言支持
 
-A few resources to get you started if this is your first Flutter project:
 
-- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
-- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
-
-For help getting started with Flutter, view our
-[online documentation](https://flutter.dev/docs), which offers tutorials,
-samples, guidance on mobile development, and a full API reference.

+ 2 - 2
android/build.gradle

@@ -1,7 +1,7 @@
 buildscript {
     repositories {
         google()
-        jcenter()
+        mavenCentral()
     }
 
     dependencies {
@@ -12,7 +12,7 @@ buildscript {
 allprojects {
     repositories {
         google()
-        jcenter()
+        mavenCentral()
     }
 }
 

+ 1 - 1
lib/main.dart

@@ -32,7 +32,7 @@ class _GameAppState extends State<GameApp> {
           left: false,
           right: false,
           child: Stack(
-            children: <Widget>[
+            children: [
               IndexPage(),
             ],
           ),

+ 2 - 2
lib/pages/index_page.dart

@@ -46,11 +46,11 @@ class IndexPage extends StatelessWidget {
                   child: Column(
                     mainAxisAlignment: MainAxisAlignment.spaceBetween,
                     crossAxisAlignment: CrossAxisAlignment.stretch,
-                    children: <Widget>[
+                    children: [
                       ModeSelector(),
                       Scores(),
                       Stack(
-                        children: <Widget>[
+                        children: [
                           GameBg(),
                           Blocks(),
                           Playground(),

+ 49 - 0
lib/responsive.dart

@@ -0,0 +1,49 @@
+import 'package:flutter/material.dart';
+
+/// Description: 响应式布局
+/// Time       : 08/03/2022 Wednesday
+/// Author     : liuyuqi.gov@msn.cn
+class Responsive extends StatelessWidget {
+  final Widget mobile;
+  final Widget tablet;
+  final Widget desktop;
+
+  const Responsive({
+    Key key,
+    @required this.mobile,
+    @required this.tablet,
+    @required this.desktop,
+  }) : super(key: key);
+
+// This size work fine on my design, maybe you need some customization depends on your design
+
+  static bool isMobile(BuildContext context) =>
+      MediaQuery.of(context).size.width < 650;
+
+  static bool isTablet(BuildContext context) =>
+      MediaQuery.of(context).size.width < 900 &&
+      MediaQuery.of(context).size.width >= 650;
+
+  static bool isDesktop(BuildContext context) =>
+      MediaQuery.of(context).size.width >= 900;
+
+  @override
+  Widget build(BuildContext context) {
+    return LayoutBuilder(
+      // If our width is more than 900 then we consider it a desktop
+      builder: (context, constraints) {
+        if (constraints.maxWidth >= 900) {
+          return desktop;
+        }
+        // If width it less then 900 and more then 650 we consider it as tablet
+        else if (constraints.maxWidth >= 650) {
+          return tablet;
+        }
+        // Or less then that we called it mobile
+        else {
+          return mobile;
+        }
+      },
+    );
+  }
+}

+ 1 - 1
lib/views/block/combin_block.dart

@@ -26,7 +26,7 @@ class CombinBlock extends BaseBlock {
     Animation<double> animation = listenable;
     return Stack(
       fit: StackFit.expand,
-      children: <Widget>[
+      children: [
         MoveBlock(
           info: BlockInfo(
             isNew: false,

+ 1 - 1
lib/views/mode_selector.dart

@@ -18,7 +18,7 @@ class ModeSelector extends StatelessWidget {
         return Container(
           child: Row(
             mainAxisAlignment: MainAxisAlignment.spaceBetween,
-            children: <Widget>[
+            children: [
               TextButton(
                 onPressed: () => vm.onChange(3),
                 child: Text('3 x 3'),

+ 7 - 7
lib/views/scores.dart

@@ -26,10 +26,10 @@ class Scores extends StatelessWidget {
       builder: (context, props) {
         return Column(
           mainAxisAlignment: MainAxisAlignment.spaceBetween,
-          children: <Widget>[
+          children: [
             Row(
               mainAxisAlignment: MainAxisAlignment.spaceBetween,
-              children: <Widget>[
+              children: [
                 Text(
                   '2048',
                   style: TextStyle(
@@ -39,7 +39,7 @@ class Scores extends StatelessWidget {
                 ),
                 Row(
                   mainAxisAlignment: MainAxisAlignment.end,
-                  children: <Widget>[
+                  children: [
                     Container(
                       padding: EdgeInsets.fromLTRB(23, 5, 23, 5),
                       margin: EdgeInsets.only(right: 5),
@@ -49,7 +49,7 @@ class Scores extends StatelessWidget {
                         borderRadius: BorderRadius.circular(5),
                       ),
                       child: Column(
-                        children: <Widget>[
+                        children: [
                           Text(
                             S.of(context).labelScore,
                             style: TextStyle(
@@ -73,7 +73,7 @@ class Scores extends StatelessWidget {
                         borderRadius: BorderRadius.circular(5),
                       ),
                       child: Column(
-                        children: <Widget>[
+                        children: [
                           Text(
                             S.of(context).labelBest,
                             style: TextStyle(
@@ -95,10 +95,10 @@ class Scores extends StatelessWidget {
             ),
             Row(
               mainAxisAlignment: MainAxisAlignment.spaceBetween,
-              children: <Widget>[
+              children: [
                 Column(
                   crossAxisAlignment: CrossAxisAlignment.start,
-                  children: <Widget>[
+                  children: [
                     Text(
                       S.of(context).titleWelcome,
                       style: TextStyle(